Hi all,
I would like to tell you of a concept I have for error handling in Servlets.
I would be delighted if anyone can provide feedback and recommendations
regarding this concept.
Concept:
Every servlet and bean within a project attempts to execute actions. If an
action causes an exception an ExceptionController object is thrown. When
thrown eg.
throw new ExceptionController(message);
the ExceptionController writes the error to the error log and performs
analysis on the error to determine what level the exception is eg is it
critical, is it medium or is it minor.
In the catch block the method catching it would perform any clean up and
then call the ExceptionControllers execute method. The ExceptionController
would then work out what to do with the error based on the level.
An example:
Calling method.....
try{
performTask(request,response);
}
catch(ExceptionController exControll)
{
//do any clean required
//then tell the ExceptionController to execute the error
exControll.execute();
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
private void performTask(HttpServletRequest request, HttpServletResponse
response) throws ExceptionController{
//this method has had an error....
catch(Exception e){
throw new ExceptionController(e.getMessage());
}
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html