开发者

Eclipse addon to temporarily disable/remove catch blocks

开发者 https://www.devze.com 2023-01-10 09:08 出处:网络
I\'ve seen questions answering this with Visual Studio vs-2008-addon-to-temporarily-disable-remove-all-catch-block

I've seen questions answering this with Visual Studio

  • vs-2008-addon-to-temporarily-disable-remove-all-catch-block
  • how-to-temporarily-deactivate-all-try-catch-blocks

but can't find anything regarding either Java or Eclipse. Does this feature exist, or is there some type of workaround I can us开发者_运维问答e instead?


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


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号