[Catalyst] Custom error

Brian Kirkbride brian.kirkbride at deeperbydesign.com
Mon Jun 25 17:32:33 GMT 2007


John Napiorkowski wrote:
> --- Evaldas Imbrasas <evaldas at imbrasas.com> wrote:
> 
>> Actually, the example below doesn't work if there
>> are any TT rendering errors.
>>
>> Is there a catch-all solution, or does it have to be
>> done on the Apache level?
> 
> I'm not sure what you mean.  If you are running in
> mod_perl and set an error status (4xx or 5xx) Apache
> will (in it's relatively default config) display a
> standard template in various languages, depending on
> the language setting for the client.  You can edit
> these if you like.
> 
> If you want catalyst to handle all this, you need to
> remove that apache stuff and catch all the error codes
> and build templates as you like.  Catalyst doesn't
> have this templates out of the box, you need to catch
> errors codes and direct them to templates you made,
> but it would be a really nice project for someone to
> do.  Right now the non debug /debug message is just
> inlined html in the Catalyst::Engine module.  It would
> be cool to break this out and have some default
> templates in TT, Mason, etc.
> 
> --john

I think what Evaldas means is that an error (template not found, etc) 
in the View rendering stage will not be caught by the method in the 
Cookbook.

I am away from my code at the moment, but IIRC the trick is to check 
$c->error AFTER you forward to MyApp::V::TT (or after the RenderView 
action) and then setup your error.tt template and forward to the view 
again.

If that doesn't make sense I can provide a code example later.

Best,
Brian



More information about the Catalyst mailing list