views:

29

answers:

3

I've seen questions answering this with Visual Studio

but can't find anything regarding either Java or Eclipse. Does this feature exist, or is there some type of workaround I can use instead?

+3  A: 

I don't know of any specific way to disable catch blocks, but what you could try is having eclipse automatically break on exceptions.

Chris Thompson
Thanks, that is what I was looking for.
Soldier.moth
Actually I do like this answer. However I still contend that this is extremely bad practice; your error logging framework should be set up in such a way to track this stuff.
Mike Miller
@Mike, indeed. "Should" is such a dangerous word ;-)
Chris Thompson
+1  A: 

There is no standard feature to do so (except rather tricky byte code rewriting).

You may, however, tell Eclipse to set a breakpoint when a given exception is thrown. The easiest way to do so, is to paste the troublesome stack trace to the stack trace panel in the Console, and click the exception name (not the lines refering to code). This will open the appropriate dialog.

Thorbjørn Ravn Andersen
Thanks for the hint unfortunately I don't have the stack trace as the catch absorbs it.
Soldier.moth
A: 

I will give the same answer that Mr Skeet gave in the second link.

Why would you want to do this?

If you are having problems with error handling hiding true errors, you should make sure the error handlers log properly and control the logging levels. I'm thinking something like Log4j.

The only valid reason someone would need to do this would be if they were maintaining someone else's lousy code with a ton of catch (Throwable t) {}. In this case you have my condolences.

PMD will scream about this kind of thing, and except in very specific circumstances it is best to rip out any eating error handlers, or at least replace them with logging.

Mike Miller
Yep, its the only valid reason, except all it does is print the name of the exception.
Soldier.moth