Debugging exception handlers

Hi,

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,

Pete

 

 

 

1 comment
Comment actions Permalink
Official comment

Hi, Peter,
Unfortunately, debug information for catched exception is not collected by scala 2.11 compiler:
https://youtrack.jetbrains.com/issue/SCL-7511

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: 
http://blog.jetbrains.com/idea/2014/09/intellij-idea-14-eap-138-1980-1-is-out/

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:
https://blog.jetbrains.com/idea/2010/09/referencing-marked-objects-in-expression-evaluation/

Please sign in to leave a comment.