Message handlers and error handling
Cantor, Scott
cantor.2 at osu.edu
Mon Apr 14 14:32:35 EDT 2014
The earliest failures I run into in the flows are usually message handler
exceptions, unsurprisingly, and this triggers a question: what should I do
to map exceptions from different handlers into useful events?
For example, SP authentication failures should eventually map back to
REQUEST_DENIED status codes in some cases, but I don't have that detail
because the handlers aren't event aware (or profile action aware at all).
I had to trap the exception being thrown by the adaptor that turns handler
chains into profile action beans because Web Flow really is clear that it
doesn't want you to use exceptions as transitions. Which is good, because
I don't either, and we basically stopped using that model (*).
But that doesn't give me a useful Event to signal back. I think we have to
do something more profile-aware with the MessageHandlers. A simple
suggestion would be to inject an event ID as a property of the handler
applying to all exceptions it raises. That's not flexible, but handles a
decent set of cases.
I guess another option is to actually set an EventContext on the
MessageContext and pick that up in the bean adaptor and move it over to
the profile context. That's a bigger code change obviously, but is the
most explicit fix.
We just have two different signaling models in the code and I think we
need fewer.
-- Scott
(*) So much so that I'd suggest we consider dumping the ProfileException
from the execute() signature on the actions. We can't do anything useful
with it and I've almost universally avoided ever using it. Possibly
totally, I haven't checked.
More information about the dev
mailing list