Perl run-time errors get kicked over to session->log->error, and

WebGUI::Middleware::StackTrace now intercepts errors as well as
fatals (since fatals are likely going away).
This commit is contained in:
Scott Walters 2011-05-22 15:23:25 -04:00
parent f4bd6d3f2f
commit 95def8a439
2 changed files with 13 additions and 1 deletions

View file

@ -155,6 +155,8 @@ sub handle {
# }
# );
# return;
local $SIG{__DIE__} = sub { $session->log->error(@_); die @_; };
# Look for the template preview HTTP headers
WebGUI::Asset::Template->processVariableHeaders($session);

View file

@ -20,9 +20,10 @@ BEGIN {
$StackTraceClass = "Devel::StackTrace::WithLexicals";
}
my $old_fatal = *WebGUI::Session::Log::fatal{CODE};
no warnings 'redefine';
my $old_fatal = *WebGUI::Session::Log::fatal{CODE};
*WebGUI::Session::Log::fatal = sub {
my $self = shift;
my $message = shift;
@ -30,6 +31,15 @@ BEGIN {
$old_fatal->($self, $message, @_);
};
my $old_error = *WebGUI::Session::Log::error{CODE};
*WebGUI::Session::Log::error = sub {
my $self = shift;
my $message = shift;
$self->{_stacktrace} = $StackTraceClass->new;
$old_error->($self, $message, @_);
};
}
sub call {