Nov 20th, 2008, 06:04 PM
just a short comment on the "error" codes for exceptions.
What i have at the moment is a code concept where the exception is not thrown bye a message but much more by a key. This is done to give the flexibility to change the Exception message with the text the developer desire, without the need of refactoring. There are no key/value pairs like structure.
To be more specific, we have a ErrorDefinitionService witt the medho getErrorById(Long id) which is used like
throw new MyException(errorService.getErrorById(longValue))) ;
The reason why its called "Error" might be misleading but EVERY error displayed in the web application is automatically translated etc.
The technical exceptions however dont need to be translated as they never reach the user in that form. In that case we only use it to avoid refactoring for error message editing.