"Rob Kinyon" <[EMAIL PROTECTED]> wrote on 08/03/2006 02:14:30 PM:
> On 7/31/06, Todd Ross <[EMAIL PROTECTED]> wrote:
> > I think CGI::Application's error handling would benefit greatly by
> > eval{}ing hooks. I routinely find myself executing code that might
die()
> > inside of a setup() routine (and/or hook) and then having to set some
kind
> > of flag so I can defer error checking until the runmode executes. It's
> > workable, but kind of a pain.
>
> Please feel free to write some failing tests as to how you think it
> should work. My initial need for error_mode was to just handle errors
> in the runmode, but it's been suggested on a number of occasions that
> having the ability to trap errors in other parts of the callstack
> (which appeared after I wrote error_mode) would be nice.
>
> I just have no need for it. :-)
So, as requested, I'm preparing a patch to add test cases for expanding
the scope of the error_mode functionality.
The hooks for prerun and postrun are pretty straight forward; they happen
during run() execution so it's a natural extension of the existing
error_mode functionality.
I'd like to catch problems in setup() and/or the hook for init, but that
happens during new() so calling the error_mode doesn't really make sense.
Additionally, I'm not sure what to do with the hooks for teardown and
load_tmpl. In all the use cases I can come up with, load_tmpl is being
called from within a runmode, so it's already covered. Maybe my
imagination is too limited, but I find the same scenario for custom hooks
(specifically, they'd be handled by the runmode). I don't have much
exposure to CGI::Application Plugins though, so if anyone's maintaining a
plugin that could benefit from error_mode error handling, please speak up.
The teardown hook happens after the content has been generated, so it's
too late to do anything useful as far as recovering or displaying an error
page to the user.
Is anyone else interested in the expanded error handling? Any thoughts to
add? Cees?
Todd Ross
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/[email protected]/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]