Skip to content

Commit

Permalink
Item14237: Use Module::Loaded to determine if exceptions are available
Browse files Browse the repository at this point in the history
This is the only case where we rely on this framework as our own
approach works better in some cases.
  • Loading branch information
vrurg committed May 14, 2018
1 parent b99be21 commit 77e9d0f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions core/lib/Foswiki.pm
Expand Up @@ -16,6 +16,7 @@ use Monitor ();
use CGI (); # Always required to get html generation tags;
use Digest::MD5 (); # For passthru and validation
use Scalar::Util ();
use Module::Loaded;

use Try::Tiny;
use Assert;
Expand Down Expand Up @@ -359,10 +360,13 @@ sub load_package {
}
catch {
#say STDERR "! Load failed for $fullname: $_";
my $e =
Foswiki::Exception::ModLoad->transmute( $_, 1,
moduleName => $fullname, );
$e->rethrow;
if ( is_loaded("Foswiki::Exception::ModLoad") ) {
my $e =
Foswiki::Exception::ModLoad->transmute( $_, 1,
moduleName => $fullname, );
$e->rethrow;
}
die $_;
};
}

Expand Down

0 comments on commit 77e9d0f

Please sign in to comment.