Reworked error handling to propogate errors downward, especially when webgui.debug is set
This commit is contained in:
parent
b815228a1b
commit
e945a94c63
12 changed files with 132 additions and 110 deletions
|
|
@ -19,7 +19,7 @@ use strict;
|
|||
use WebGUI::Paths;
|
||||
use WebGUI::Exception;
|
||||
use Sub::Uplevel;
|
||||
use Scalar::Util qw(weaken);
|
||||
use Scalar::Util qw(weaken blessed);
|
||||
|
||||
=head1 NAME
|
||||
|
||||
|
|
@ -147,8 +147,15 @@ The message to use.
|
|||
sub fatal {
|
||||
my $self = shift;
|
||||
my $message = shift;
|
||||
my $error_obj = shift;
|
||||
Sub::Uplevel::uplevel( 1, $self->getLogger, { level => 'fatal', message => $message});
|
||||
WebGUI::Error::Fatal->throw( error => $message );
|
||||
if( blessed $error_obj and $error_obj->can('rethrow') ) {
|
||||
# Exception::Class objects have valuable stack traces built in to them; rethrow the existing error to preserve that if possible
|
||||
$error_obj->rethrow;
|
||||
} else
|
||||
{
|
||||
WebGUI::Error::Fatal->throw( error => $message );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue