On Sat, Sep 10, 2016 at 8:26 AM, Abelard <abelardhoff...@gmail.com> wrote:

> So the idiom would be something like:
>
> eval { dispatch() };
> if ($@) {
>   $env->{'plack.stacktrace.rethrow'} = 1;
>   die "now with more suds! $@";
> }
>
> Thoughts?

Using that eval idiom is a logic error. The $@ is only significant if
the eval itself fails, so do:

eval {
    dispatch();
    1;
} or do {
    my $error = $@ || "Zombie Error";
    ....;
};

It's an error because:

1. The app could do an eval {} somewhere which'll set $@ but not die,
now you die because you check if $@ is set without *your* eval
failing.

2. You can die but $@ can get lost due to various past/current
bugs/misfeatures of perl, hence the "Zombie Error";.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"psgi-plack" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to psgi-plack+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to