See this question on how to break on any exceptions.
I'm getting a million exceptions on startup. I've tried ignoring ClassNotFoundException, but it's no good, the IDE still seems to break on these (and other) exceptions.
So .. what's a decent configuration for this to catch only real exceptions caught from user code? (Ignore also any exception in jUnit, if applicable)
Set exception breakpointsin the left part of the Debug tool window or press Ctrl+Shift+F8 . Depending on the type of the exception: If you want to suspend the program when any instance of Throwable is thrown, check Any Exception under Java Exceptions.
Step Over (F8) lets you execute a line of code and move on to the next line. As you step through the code, you'll see the value of the variables next to the code in the editor window. These values are also visible in the Variables pane in the Debug window.
Throw an exception Make sure the current method is selected on the Frames tab, then right-click anywhere in the tab and select Throw Exception. Create the exception (this can be any Throwable including Error and checked exceptions that are not handled by the method).
As mentioned by the other posters, Class Filters are the way to do this.
Specifically, you could add the package names for what you consider "your code" as a class filter. The syntax is a little opaque, but using a simple wildcard filter like:
com.whatever.package.*
sounds like it it will work for you. IntelliJ will break on any exception in any class in any package under here. You can of course define multiple wildcard filters if your code is in more than one place.
I was just messing with this earlier. Two ways to go:
1) Configure it to explicitly catch your exception, not "any exception" - if it's something like RuntimeException, this may not be filter-y enough. 2) Use the class results filter - this for whatever reason did NOT work for me. Ever.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With