Exceptions, part of life. 🙂 But if we can handle them in well defined manner, life becomes very easy. I couldn’t find any suitable framework in Java taking care of exceptions.
Recently I came across Spring – RCP (Rich Client Project – not sure if project is dead couldn’t see any major release in recent past and the manual still in TODO mode), and found that it provides nice way to handle exceptions in Spring way. While it provides way to execute handlers based on type of exception being thrown, it doesn’t offer feature of executing handlers based on the type of object (Class) throwing an error.
So I thought of implementing my own exception handler using Spring and AOP which can help me to define exception handling for class as well as for type of exception and leverage all features of Spring in handlers.
Watch this space for further information.
Finally done with creation of Exception handling framework and would be publishing artifacts related to it in next few days.
Following diagram depicts class structure for framework.
The diagram shows various built-in handlers and configuration option that come built-in with framework.
Lets have a look at the sequence diagram which shows flow of operations when an exception occurs.
The ExceptionProcessor displayed in above diagrams is invoked by custom interceptor available with framework. In case of non-spring application, it can be executed by an implementation of UncaughtExceptionHandler (available with core Java).
I will soon release more details about configuration and framework files.