Re: [Maypole-dev] error handling

From: Simon Flack (sf at flacks.net)
Date: Thu Dec 30 2004 - 03:48:14 GMT


Dave Howorth wrote:
[snip debug() & 404 errors]
>
> There's also another issue. While testing I noticed that if you give a
> valid table and action (e.g. view) but an invalid object id, Maypole
> shows the resulting page (an empty view page for example). If you press
> edit on that view page it goes to a garbled URL (.../beer.cgi//edit/).
>
> What happens is Class::DBI returns undef from the retrieve, and
> M::M::CDBI->fetch_objects passes undef back. M::M::Base->process
> packages the undef in a list reference! and invokes the action. I'm not
> sure what should happen here. At one extreme you could argue that this
> is OK and each and every action/template ought to test for that case for
> ultimate flexibility. At the other extreme, I think process() could just
> unset the template and return so eventually M::V::Base->error would drop
> into the 404 case. Or you could add hooks in various places etc etc.

This is a bug. I've fixed it in the repository by restoring the previous
behaviour - if there isn't an object, $r->objects is left undefined. I
don't think we'd want to unset the template and return an error if there
aren't any objects - that would break actions like 'list' and 'search'.

>> 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.
>
>
> Errm isn't exception() only called in the specific case of authenticate,
> model-process or view-process internal failures (which perhaps *should*
> be 500s) as opposed to the case of them returning an ERROR or DECLINED
> status?

Hmm. I was thinking of authenticate(); I don't don't why I typed
'exception'.

> Incidentally, do you know why DECLINED has the same value as ERROR?

No. I think DECLINED is -1 because that's how it's defined in apache's
httpd.h. I don't know where ERROR comes from.

>> 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.
>
>
> I'd agree with that :) I'd got as far in my investigation as making
> some notes. I've included them below; they're just my opinion.

Thanks, that is very helpful.

Simon

_______________________________________________
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