Centralized Exception handling for Eclipse plug-in

Posted by Svilen on Stack Overflow See other posts from Stack Overflow or by Svilen
Published on 2009-11-25T12:19:09Z Indexed on 2010/04/15 20:13 UTC
Read the original article Hit count: 261

Filed under:
|

Hello,

At first I thought this would be question often asked, however trying (and failing) to look up info on this proved me wrong.

Is there a mechanism in Eclipse platform for centralized exception handling of exceptions?

For example... You have plug-in project which connects to a DB and issues queries, results of which are used to populate some e.g. views. This is like the most common example ever. :) Queries are executed almost for any user action, from every UI control the plug-in provides. Most likely the DB Query API will have some specific to the DB SomeDBGeneralException declared as being thrown by it. That's OK, you can handle those according to whatever your software design is. But how about unchecked exceptions which are likely to occur, e.g. , when communication with DB suddenly breaks for some network related reason? What if in such case one would like to catch those exceptions in a central place and for example provide user friendly message to the user (rather than the low level communication protocol api messages) and even some possible actions the user could execute in order to deal with the specific problem?

Thinking in Eclipse platform context, the question may be rephrased as "Is there an extension point like "org.eclipse.ExceptionHandler" which allows to declare exception handlers for specific (some kind of filtering support) exceptions giving a lot of flexibility with the actual handling?"

© Stack Overflow or respective owner

Related posts about eclipse

Related posts about exception-handling