[rules-users] How to do Exception Handling???
Kris Verlaenen
kris.verlaenen at cs.kuleuven.be
Mon Apr 12 10:21:14 EDT 2010
The main problems I see when translating a java exception to a process
exception automatically:
- the exceptions are too low level, no business user understands
NumberFormatException or ClassCastException, and the error could come from
deep inside the invoked service
- by making it automatic, the user is not forced to think about it and thus
might forget about it, so you might end up with aborted process instances
(default behaviour if no exception handler can be found) and the user won't
even notice
- the handler is actually the link between the process engine and the
environment, I see it as a contract between the two, and what data is
exchanged (input/output) is defined
It is trivial to simply create an AbstractWorkItemHandler that would
transform a Java exception to a process fault with the same name. If you
want this as the default behaviour, I suggest you do that. But if we build
this into the framework, it will be more difficult to change it if you don't
want this behaviour (and we try to keep the maximum flexibility possible).
Kris
> If every workitem needs to have a "try / catch" block, just to make
> sure
> that all possible exceptions are handled gracefully, would not that be a
> framework concern to have a mechanism that _converts_ these exceptions to
> some return "error" parameters (just contemplating here) OR to allow a
> workitem node to take an ExceptionHandler that would signal an event or
> convert it to the result parameter, etc..?
>
> I understand that you are coming from the fact that Java Exceptions are
> too low level, and are not Process Exceptions, but they really are :)
> [something went "kaboom" within the _Process_] just need to be converted
> to
> ones, and it would be a natural concern for a "Java" framework.
>
> One custom approach that I am thinking about so far is to wrap all
> workitems with "AfterThrowing" advice to do just that, but again this
> rather
> feels like a "work around".
>
> Thank you,
> /Anatoly
>
> P.S. By the way, would be cool to address real "Java" Exceptions (no
> matter
> what the approach is) in Exception Handling section of the documentation
> :)
> --
> View this message in context:
> http://n3.nabble.com/How-to-do-Exception-Handling-tp689387p707668.html
> Sent from the Drools - User mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
More information about the rules-users
mailing list