[Catalyst] How to manage error 404

Marcello m.romani at spinsoft.it
Tue Jun 28 14:29:22 CEST 2005


Chisel Wright ha scritto:
> On Tue, Jun 28, 2005 at 11:10:17AM +0200, Marcello wrote:
> 
>>A quick solutino I found to this problem is to have in my application 
>>package a default action like this:
>>
>>sub default : Private {
>>    my ( $self, $c ) = @_;
>>    $c->stash->{template} = 'invalid_request';
>>    $c->req->action(undef);
>>}
> 
> 
> I've not tried this out, but what about:
> 
>  sub default : Private {
>     my ( $self, $c ) = @_;
> 	# use the default 404 page for the server
>     $c->res->status(404);
> 	# make sure we have no action
>     $c->req->action(undef);
>  }
> 
> I don't know if undefining the action is still required, but I don't see
> any harm in leaving it there.
> 
> Chisel

IE on winxp sp2 displays an error page, while firefox on the same 
machine just displays a blank page.
I think an informative page (even if an error one) is still better than 
a 404 one.
The OP might have different requirements though.

Marcello



More information about the Catalyst mailing list