Skip to content

Instantly share code, notes, and snippets.

@MasterDuke17
Created July 15, 2017 13:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MasterDuke17/841d28aba75ecdab1c582f173d7d6321 to your computer and use it in GitHub Desktop.
Save MasterDuke17/841d28aba75ecdab1c582f173d7d6321 to your computer and use it in GitHub Desktop.
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