Custom exception handling

Several places in my plugin could potentially throw specific typed exceptions. I would like to register some sort of handler to deal with these exceptions before the generic IntelliJ error handling kicks in. I've looked through the platform extension points and don't see anything that would work for this. There is the "errorHandler" extension point, but that's specifically for reporting.

Is there some way to potentially catch errors to either elevate or handle? Some way to register an exception handler?


Have you considered using a try/catch statement?



This stack overflow post does a great job of describing what I'd like to accomplish (and a similar situation), and the answers point to how it could be done in Eclipse:


There is no equivalent API in the IntelliJ Platform.


Hi Matt,

I personally have no Eclipse plugin development myself; So I'm not sure how often this kind of requirement comes up when developing Eclipse plugins.

But as a general answer; If try/catches arn't doing it for you, you could possibly look at using AOP for handling exceptions in a more generic manner within classes/methods that you have created, which is  great if you're worried about the smell of try/catching possible runtime exceptions.



Please sign in to leave a comment.