[Catalyst] Chained and exceptions

Lukas Thiemeier spamcatcher at thiemeier.net
Thu May 9 16:24:57 GMT 2013


On 05/09/2013 05:31 PM, Bill Moseley wrote:

> 
> 
> Hi Lukas, 
> 
> Sorry, you missed the point.  Yes, Catalyst traps exceptions.  That is
> expected and is done in handle_request when calling $c->dispatch.
> 
> I'm talking about breaking a chain of actions.     Why would a later
> part of the chain run if an earlier part threw an exception.   For
> example, what if an earlier part of a chain threw a access violation.
>  In that case you would not want the later chain to run.
> 
> 

Well, I answered your first question:

> What's the reasoning that chained actions continue to run after an
> earlier exception?

Answer: Because Catalyst traps those exceptions. :)

Ok, now seriously:

I personally don't think that the current behavior is wrong. IMO a
chained action depends on its predecessor to be run, but not to be run
successfully. Maybe somebody wants to handle certain exceptions later in
the same action chain. I don't say that this is a good idea. I just say
that I can think of usecases where this would be useful.

As we both know, catching exceptions and detaching is easy. Not
detaching if detaching the default behavior would be more work.

But thats just my opinion.

I have found several old discussions about this topic in the archives. I
didn't go through all of them in detail. But I have  learned that the
main reason why this was never fixed is that it would break old
applications which rely on the current behavior.

Take a look here:
http://www.gossamer-threads.com/lists/catalyst/users/28788#28788

Lukas



More information about the Catalyst mailing list