Plack::Middleware::StackTrace and rethrow
Plack::Middleware::StackTrace displays last exception information since the code is:
my $trace;
local $SIG{__DIE__} = sub {
$trace = $StackTraceClass->new;
die @_;
};
If you are using 'rethrow', you will get the stack-trace from the point.
use Try::Tiny;
sub f {
die "YAY";
}
sub {
try {
f()
} catch {
die $_; # <-- you get stack trace from here!
}
}
My answer for this issue is:
use Try::Tiny;
sub f {
die "YAY"; # <-- you get stack trace from here!
}
sub {
try {
f()
} catch {
local $SIG{__DIE__} = 'DEFAULT';
die $_;
}
}
Published: 2010-11-09(Tue) 08:36