Skip to content

Commit

Permalink
Item13897: Merge of Foswiki::Exception.pm from Item14152
Browse files Browse the repository at this point in the history
Foswiki::Exception::transmute doesn't enforce an exception into destination
class if the exception's class is a subclass of destination.
  • Loading branch information
vrurg committed Sep 1, 2016
1 parent e9fecba commit cfb5a27
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions core/lib/Foswiki/Exception.pm
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ sub transmute {
if DEBUG;
if ( ref($e) ) {
if ( $e->isa('Foswiki::Exception') ) {
if ( !$enforce || ( ref($e) eq $class ) ) {
if ( !$enforce || $e->isa($class) ) {
return $e;
}
return $class->new( %$e, @_ );
Expand Down Expand Up @@ -390,13 +390,14 @@ extends qw(Foswiki::Exception);
# For informational exceptions.

package Foswiki::Exception::Fatal;
use Assert;
use Foswiki::Class;
extends qw(Foswiki::Exception);

sub BUILD {
my $this = shift;

say STDERR $this->stringify, $this->stacktrace;
say STDERR $this->stringify, $this->stacktrace if DEBUG;
}

# To cover perl/system errors.
Expand Down

0 comments on commit cfb5a27

Please sign in to comment.