Debugging exception handlers


I'm trying to debug and I've traced an exception to some third party code:

    catch {
      case e:Exception=> {
        throw new RuntimeException("could not map row :\n" + dumpRow(resultSet) + "\n with mapper :\n" + this, e)

The call to 'dumpRow' causes another exception so the original one is masked.  Unfortunately, when I put a break point on the 'throw' line I cannot inspect the 'e' variable; it's not in the list of variables.  And when I evaluate the expression 'e.getMessage()', all I get is "cannot find local variable 'e'".

What am I missing?

Thanks in advance,





1 comment
Comment actions Permalink
Official comment

Hi, Peter,
Unfortunately, debug information for catched exception is not collected by scala 2.11 compiler:

I found a possible workaround recently, but I'm not sure if it will work in your case. You may try to find this exception in the reference graph of the VM with the "Show referring objects" feature:

You may start from classOf[YourExceptionClassName]. All instances of a class hold a reference to the java.lang.Class object, so you should be able to find if there are some instances around. If you don't know exact class of the exception, you may start from classOf[Exception] and check all loaded inheritor classes.

After you'll find an instance of exception, you may mark it and use in Evaluate Expression:

Please sign in to leave a comment.