Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Filter stacktrace frame using our own, so that anything outer than th…

…is middleware (like web server's context) are filtered out
  • Loading branch information...
commit 85d5a9c3df994c2e6f979c676043f3411529ced3 1 parent f55ded0
@miyagawa authored
Showing with 16 additions and 1 deletion.
  1. +16 −1 lib/Plack/Middleware/InteractiveDebugger.pm
View
17 lib/Plack/Middleware/InteractiveDebugger.pm
@@ -99,7 +99,6 @@ sub call {
local $SIG{__DIE__} = sub {
$trace = Devel::StackTrace::WithLexicals->new(
indent => 1, message => munge_error($_[0], [ caller ]),
- ignore_package => __PACKAGE__,
);
die @_;
};
@@ -113,6 +112,7 @@ sub call {
};
if ($trace && ($caught || (ref $res eq 'ARRAY' && $res->[0] == 500)) ) {
+ $self->filter_frames($trace);
my $html = render_full($env, $trace);
$res = [500, ['Content-Type' => 'text/html; charset=utf-8'], [ utf8_safe($html) ]];
@@ -126,6 +126,21 @@ sub call {
return $res;
}
+sub filter_frames {
+ my($self, $trace) = @_;
+
+ my @new_frames;
+ my @frames = $trace->frames;
+ shift @frames if $frames[0]->filename eq __FILE__;
+
+ for my $frame (@frames) {
+ push @new_frames, $frame;
+ last if $frame->filename eq __FILE__;
+ }
+
+ $trace->{frames} = \@new_frames;
+}
+
# below is a copy from StackTrace
sub no_trace_error {
Please sign in to comment.
Something went wrong with that request. Please try again.