[Catalyst-dev] A suggestion(or question) about exception handling.

Tomas Doran bobtfish at bobtfish.net
Wed Jul 23 17:33:53 BST 2008


On 23 Jul 2008, at 16:59, Kee Hinckley wrote:
> I use Error extensively in Catalyst, but I understand the problem  
> he raises.  Right now Catalyst traps errors itself Catalyst::execute 
> ().  What Chae Lee probably wants (I know I do) is a way to insert  
> an Error handler that traps those errors, or at the very least,  
> uses try/catch so that what gets stored in $c->error are Error  
> objects instead of strings.

Putting:

BEGIN { $Catalyst::Exception::CATALYST_EXCEPTION_CLASS = 'Error'; }

in MyApp.pm should do what you want, shouldn't it?

I'd also refer you to Bricas' blog post about using classful  
exceptions in Catalyst:
http://bricas.vox.com/library/post/catalyst-exceptionclass.html

Whilst I don't use this, I think that this is about what you want..

It'd be good to see this made this easier and/or for it to be more  
'officially' documented however. :)

Cheers
Tom




More information about the Catalyst-dev mailing list