Visual Studio has an option to break automatically into the debugger when an unhandled exception is thrown, does Eclipse have similar functionality?
Break when exception is thrown
Asked Answered
Would #588112 help? –
Kellene
good one, I didnt 'catch' that in my pre-post searching –
Audraaudras
You are able to define the precise list of Exception you want to have a breakpoint on, even if those exceptions are uncaught (which should be the equivalent of "unhandled
")
What isn't clear here is whether the debugger will break on ANY exception when "Suspend on uncaught exceptions" is checked off. In the example above, does it mean break on any uncaught exceptions of the type "ActivationException", or does it mean break on any uncaught exception of any type? Very poorly described. –
Pitre
@Pitre I'm thinking that if you select the plain "Exception" exception then it will. or should. –
Rectus
Go to the breakpoints window, there's a button that looks like J!, there you can set breakpoints for Java exceptions, either caught or uncaught. You can reference classes or use pattern matchers for exception names.
Also, under Window -> Preferences, Select Java -> Debug and there's a checkbox to tell the debugger to break on uncaught exceptions
@JaySullivan It's on the far right, so if the pane is too small, you will need to expand it. It's the circled icon on the top right of the screenshot in the accepted answer. –
Hypertonic
The Window/Preference/java/debug solution is a really good complement to the accepted answer, this answer deserve more upvotes. –
Goddord
You also need:
Subclasses of this exception
checked - got that from here: https://mcmap.net/q/111525/-how-can-i-make-eclipse-to-break-on-all-uncaught-exceptions –
Izaak © 2022 - 2024 — McMap. All rights reserved.