Cluebat needed for working with the error handling

Ask Bjørn Hansen <[email protected]> Mon, 13 Sep 2010 02:30:47 -0700
Newsgroups gmane.comp.web.mason.devel
Message-ID <[email protected]>
Somewhat related to the index.html post:

In my project that's now running on Plack/PSGI[1] I need to handle 404's mo=
re gracefully than they are by default.  By default the 404s show up just a=
s server errors.

Under apache the request handler uses _handle_error() to rethrow =


sub _handle_error
{
    my ($self, $err) =3D @_;

    if (isa_mason_exception($err, 'TopLevelNotFound')) {
        rethrow_exception $err;
...

... and I'm guessing this somehow gets turned into declining the request vi=
a the mod_perl API?

Anyway - what am I supposed to do to return something else in this case?

I'd be happy just returning a static string and flagging the request to set=
 the status as 404; but ideally I'd like to be able to  "restart" the reque=
st with a $error_404_url or run a bit of code to generate the response.

Any hints would be appreciated -- I stared at the code for almost an hour a=
nd got nowhere.   It's been, ahem, a few years since I worked with Mason. :=
-)


 - ask

[1] http://github.com/abh/HTML-Mason-PSGIHandler -- thanks to miyagawa.

-- =

Ask Bj=F8rn Hansen, http://askask.com/




---------------------------------------------------------------------------=
---
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing
http://p.sf.net/sfu/novell-sfdev2dev