Exception handling pattern

Posted by treefrog on Stack Overflow See other posts from Stack Overflow or by treefrog
Published on 2011-01-04T00:49:10Z Indexed on 2011/01/04 0:53 UTC
Read the original article Hit count: 132

It is a common pattern I see where the error codes associated with an exception are stored as Static final ints. when the exception is created to be thrown, it is constructed with one of these codes along with an error message. This results in the method that is going to catch it having to look at the code and then decide on a course of action. The alternative seems to be- declare a class for EVERY exception error case

Is there a middle ground ? what is the recommended method ?

© Stack Overflow or respective owner

Related posts about java

Related posts about exception