Exception handling pattern
- by treefrog
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 ?