[Catalyst] Custom finalize_error

Jim Spath jspath at pangeamedia.com
Mon Apr 2 21:40:10 GMT 2007

Jason Kohles wrote:
> On Apr 2, 2007, at 4:13 PM, Jim Spath wrote:
>> I wanted to get rid of the "Please come back later" error page, so I 
>> defined my own finalize_error() in MyApp.pm as mentioned in this post:
>> http://www.mail-archive.com/catalyst@lists.rawmode.org/msg04542.html
>> It looks like:
>> sub finalize_error {
>>   my ($self, $c) = @_;
>>   $c->stash->{'template'} = 'error.tt2';
>> }
>> The "Please come back later" page no longer appears, but now the page 
>> is simply blank.  I've double checked to make sure the error.tt2 
>> template is accessible via Catalyst and it is, so I'm unsure where to 
>> go from here.
> finalize_error is called long after the view processing has already been 
> done, if you want to use a template to put a page there, you have to 
> build your own Template object and process the template yourself.

Ah.  Great, thanks!  I got it to work with the following code:

sub finalize_error {
   my ($c) = @_;

   $c->response->content_type('text/html; charset=utf-8');
   $c->response->body($c->view('Website')->render($c, 'error.tt2'));


Jim Spath
Lead Developer
Pangea Media
Em: jspath at pangeamedia.com
Ph: 617.314.6687
Fx: 617.390.7824
IM: panJimS (AIM)

More information about the Catalyst mailing list