Debugging unhandled exceptions in java/tomcat servlets




After a year of using IDEA I still struggle trying to make exception breakpoints work for me.

The problem is that tomcat catches all the exceptions that are thrown, but not handled by my code. Thus I have to enable breakpoints on caught exceptions to use exception breakpoints feature at all. However, when I do that I start breaking on all the exceptions triggered by java libraries and tomcat itself. This makes it very difficult to use. I have to set a breakpoint at the beginning of a controller method I'm debugging, and when it hits, I have to go to breakpoints dialog and manually enable "Any exception" checkbox. Then continue execution until expected exception hits and then go and disable "Any exception" again. This is slow and frustrating and you have to expect method to fail.

I've tried applying class filters, but it is no good since it usually throws an exception from some java library, which is not one of my classes or packages. I've tried setting flags in code and use them as conditions for breakpoints, but IDE cannot evaluate these conditions as my classes don't exist at the start.

What I'd really like to have is a breakpoint condition that triggers only in case an exception wasn't caught anywhere above certain stack level defined programmatically or by first entry to a specific package. Is it possible?




1 comment
Comment actions Permalink

Hi, this is not possible currently, I filed to add catch location filter, please vote.


Please sign in to leave a comment.