[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cgiapp] Re: CGI::App 3.2 proposed release available


On 2003-11-25, Steve Hay <suppressed> wrote:
>
> I'll accept that invitation!  First, a quick refresher of what the 
> problem is:
>
> The code in C::A that causes problems for my exception handling is these 
> two lines in the run() method:
>
>     my $body = eval { $autoload_mode ? $self->$rmeth($rm) : 
> $self->$rmeth() };
>     die "Error executing run mode '$rm': $@" if $@;
>
> In the case of exceptions thrown by the run mode method in question (as 
> opposed to C::A itself having an error, e.g. the run mode method can't 
> be dispatched), catching (eval) and then rethrowing (die) the exception 
> in this way causes two problems for me:
>
> Problem 1. It assumes that the exception in $@ is a string.  I'm trying 
> to setup a system based around Exception::Class that uses Perl's 
> exception objects.  The above code stringifies the exception object in 
> suppressed  (Exception::Class' objects overload stringification, so that at 
> least a decent error message is still produced, but all of the other 
> information on the object is lost.)
>
> Problem 2. It adds an extra frame into the stack trace, which confuses 
> modules like Exception::Class as to where the exception comes from.  
> (That is, E::C now thinks that the error was in C::A::run() instead of 
> somewhere inside the run mode method where it really was.)

Steve,

I agree this seems worthwhile to address. I like solutions 2 and 3 you
propose, with a preference for "2" now. We could always start there and
add the complexity of "3". later. It seems there are already some
built-in ways to override what "die" is doing if people want to use
them.

I'll wait for more feedback from others before applying the patch.

	Mark

-- 
 . . . . . . . . . . . . . . . . . . . . . . . . . . . 
   Mark Stosberg            Principal Developer  
   suppressed     Summersault, LLC     
   765-939-9301 ext 202     database driven websites
 . . . . . http://www.summersault.com/ . . . . . . . .


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/suppressed/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.