[Catalyst] How to manage error 404

Chisel Wright chisel at herlpacker.co.uk
Tue Jun 28 11:54:52 CEST 2005


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
-- 
Chisel Wright
e: chisel at herlpacker.co.uk
w: http://www.herlpacker.co.uk/



More information about the Catalyst mailing list