beehive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rich Feit <>
Subject Re: catching exceptions from all over the place?
Date Tue, 05 Jul 2005 18:52:26 GMT
Hi Adam,

There are two main ways to share an exception handler:

    1) put a @Jpf.Catch in a base class, or

    2) put a @Jpf.Catch in a shared flow (which, if referenced by a page 
flow, will automatically catch the exception):

        public class ExceptionsSharedFlow
            extends SharedFlowController

If you put it in a shared flow, then you can add the reference to an 
individual page flow like this:

...or you can make the shared flow apply for *all* page flows by adding 
it in beehive-netui-config.xml 


Doing exception-handling through a shared flow is useful when the 
exception handler needs to access shared state (since a single instance 
of the shared flow class is created/accessed in the session).  It's also 
useful when adding a base class is impossible/impractical.

Let me know if you need more information on any of this.


Adam Jenkins wrote:

>Hi Guys,
>Hope everyone is well.  I was wondering if there is a way to set a
>default handler method for an exception regardless of from where it's
>i.e.  I have the following controllers:
>And I have a handler method in / such:
>    @Jpf.ExceptionHandler(
>        forwards={
>            @Jpf.Forward(name="handled",
>        }
>    )
>    public Forward handleDataSystemException(
>            final DataSystemException exception,
>            final String actionName,
>            final String message,
>            final Object formBean){
>        log.error("Error executing action " + actionName, exception);
>        return new Forward("handled");
>    }
>I have a method in /certs/requests/ such:
>        @Jpf.Action(
>                forwards={
>                   @Jpf.Forward(name="success",
>                }
>        )
>        protected Forward begin() throws DataSystemException {
>        log.debug("/certs/requests/Controller.begin()");
>        final Collection<Request> currentRequests =
>OJBUtils.<Request>loadAll(Request.class, DBKEY);
>        if(log.isDebugEnabled()){
>            log.debug("Loaded Request: " + currentRequests);
>        }
>        final Forward forward = new Forward("success");
>        forward.addActionOutput("requests", currentRequests);
>        return forward;
>        }
>Now...DataSystemException can pretty much be thrown from anywhere in the
>app that is doing anything with the database (ojb actually) there
>any way I can make them all route to the method above
>in / (for example, above if thrown
>from /certs/requests/Controller.begin() I want it handled
>by /Controller.handleDataSystemException(...))?

View raw message