Re: [Maypole-dev] error handling

From: Simon Flack (sf at flacks.net)
Date: Tue Dec 28 2004 - 19:08:39 GMT


Dave Howorth wrote:
> I'm trying to get to grips with Maypole's error handling.
>
> There are many circumstances detected in handler_guts where the handler
> just returns the status code -1 without calling send_output. This
> results in the user seeing an HTTP 500 Server Error page, which I
> believe is inappropriate for circumstances such as a plain page not
> being found, or an authorization failure, or in fact any problem caused
> by inappropriate input from the browser that Maypole has been able to
> detect.

This isn't the solution, but you may find that you get better behaviour
if you enable 'debug'.

> This happens with CGI, I don't know how it behaves in mod_perl?

You're getting a 500 error with CGI because there is no output. With a
properly configured mod_perl the status codes will pass control back to
the core apache content handler.

> One can argue that Maypole doesn't know what you want to do so it
> doesn't guess :) but I feel it ought to at least return a sensible HTTP
> response code to the browser, rather than just claiming to have died!
> Certainly if I'm browsing and get a 500 from a site, it doesn't inspire
> me with confidence in the website's authors. IMHO, it would also be
> sensible to have some default factory templates for these cases (403,
> 404 etc) that users could then easily replace by adding custom templates.

You can set a custom 404 page with Maypole 2.05 and TT2:

        __PACKAGE__->config->view_options({
                DEFAULT => 'error404.tt',
        });

And you can set a 403 template in your MyDriver->exception. I expect
that Maypole will respond with a 200 OK status in both these cases.

That is not to say that Maypole couldn't/shouldn't be a bit more
intelligent when it comes to processing errors, just that you don't have
to settle for the default error handling.

I think this is mostly a CGI issue. I have some ideas for how we may
solve this but the handler() is already quite complicated, so I want to
work on some use cases first.

--simonflk

_______________________________________________
maypole-dev mailing list
maypole-dev at lists.netthink.co.uk
http://lists.netthink.co.uk/listinfo/maypole-dev



This archive was generated by hypermail 2.1.3 : Thu Feb 24 2005 - 22:25:57 GMT