ObjectWeb Consortium
Search ObjectWeb Mail Archive: 

Advanced Search - Powered by Google


Mail Archive Home | enhydra List | May 2004 Index

<--  Date Index  --> <--  Thread Index  -->

Re: [enhydra] Custom Exception Handling


(Sorry If this is a duplicate...)


Hi Casey,
In your Presentation packages you can create a class called
ErrorHandler.class (ErrorHandler.java)

This class must implement
com.lutris.appserver.server.httpPresentation.HttpPresentation.
In the run() method  that you must implement,  you will be passed the
HttpPresentationComms object.
This object has a field called 'exception'.

    public void run(HttpPresentationComms comms) throws
HttpPresentationException {
        Exception myException = comms.exception;
        ' do someting here.., maybe log the exception etc.
        '
        ' create a custom Error page, and then display it.
        comms.response.writeDOM(myCustomErrorMsgPage);
 }

Of course you could also throw a ClientPageRedirectionException to send the
user somewhere else...

Enhydra allows a hierarchy of these ErrorHandler classes. For example you
can have one in presentation, another in presentation.games, another in
presentation.admin, another in presentation.utilities etc. depends on your
app layout.
If it doesn't find one in the current package for the current page, it will
go up the tree, looking for one, if it doesn't find any, you will ge the
standard Exception stack trace printed to the user...  So creating a
'presentation.ErrorHandler.class' will be a 'catch-all' for your app.
Hope this helps.
Mike.






<--  Date Index  --> <--  Thread Index  -->

Reply via email to:

Powered by MHonArc.

Copyright © 1999-2005, ObjectWeb Consortium | contact | webmaster.