Announcement Announcement Module
Collapse
No announcement yet.
Returning an error() with an exception. Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Returning an error() with an exception.

    I have a MultiAction class that in many cases returns an error(). However I would like to return an error event that may contain a few different exceptions thrown in the service layer. Like so:

    Code:
    ....
    public Event someAction(RequestContext context) {
       ...
    return error(someExceptionObjectFromServiceLayer);
    ...    
    
    }
    ...
    My question is this: In my flow.xml file, how do I determine the exception used above (someExceptionObjectFromServiceLayer in this case) and then route accordingly?
    Code:
    ...
    <transition on="error" to="someOtherState" />
    ...
    Thanks in advance.
    Jeff

  • #2
    Can you use the on-exception attribute on the transition?

    Code:
    ....
    public Event someAction(RequestContext context) throws SomeExceptionObjectFromServiceLayer {
       ...
    }
    ...
    Code:
    ...
    <transition on-exception="com.yourcorp.SomeExceptionObjectFromServiceLayer" to="someOtherState" />
    ...

    Comment

    Working...
    X