-
-
Save MasterDuke17/841d28aba75ecdab1c582f173d7d6321 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/core/Exception.pm b/src/core/Exception.pm | |
index d363ef9f4..86e7afc53 100644 | |
--- a/src/core/Exception.pm | |
+++ b/src/core/Exception.pm | |
@@ -54,7 +54,14 @@ my class Exception { | |
$!ex := nqp::newexception() unless nqp::isconcrete($!ex) and $bt; | |
$!bt := $bt; # Even if !$bt | |
nqp::setpayload($!ex, nqp::decont(self)); | |
- nqp::setmessage($!ex, self.message) if nqp::existskey(nqp::atkey(%*COMPILING, '%?OPTIONS'), 'll-exception'); | |
+ if nqp::existskey(nqp::atkey(%*COMPILING, '%?OPTIONS'), 'll-exception') { | |
+ my $msg := try self.?message; | |
+ if defined($msg) { | |
+ $msg := try ~$msg; | |
+ } | |
+ $msg := $msg // "{self.^name} exception produced no message"; | |
+ nqp::setmessage($!ex, nqp::unbox_s($msg)); | |
+ } | |
nqp::throw($!ex) | |
} | |
method rethrow(Exception:D:) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment