Hi.

I have an app that catches exceptions and appends data to it. In 
development, I'd like to use Plack::Middleware::StackTrace to display the 
trace. However, since I'm rethrowing a modified error message, it isn't 
finding the Devel::StraceTrack that was built.

For example, I'm doing something along these lines:

eval { dispatch() };
if (my $error = $@) {
  $error .= " lots of details about system state";
  die $error;
}

>From my understanding of P::M::ST, the $SIG{DIE} handler is being trigged 
when the exception is raised in the eval. It's building the stack trace off 
of that, which is what I want.
Then I go fiddling with the error and re-raise it. Since the error has been 
changed it doesn't match anything in %string_traces, resulting in the real 
backtrace being lost.

Is there a way around that?

I found Plack::Middleware::RethrowFriendly, but I'm not sure if it's 
intended to handle this case. I tried it and it didn't seem to show the 
backtrace from within the eval.

I was thinking that if I can modify $@ before the $SIG{DIE} handler gets 
it, maybe that would work, but I'm not sure how to do that.

Thanks -A

-- 

--- 
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