chaitanya chaitanya - 1 year ago 81
Java Question

framework for handling exception in java

Is there any framework that can handle java exception such that there is no need for writing

try catch
blocks in java .
Here exception's were both checked and unchecked exception .
Either by using annotation or any other kind of patterns. Is there a way to this thing globally like a framework such that it can be used for any other projects.

Answer Source

Instead of catching the exception, you can always throw it.

The point of exceptions is that they do not need to be handled directly where they are thrown but in any of the calling methods where it might make more sense. This can very well be in the main method of your main class.

If you find yourself writing code where each function call is wrapped in its own try block, you are probably doing exception handling wrong.

I cannot imagine a general exception handling framework, that does more than Java exceptions already do, to be useful.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download