in reply to [Perl 6]: Small discoveries VI, die
In Perl 6 die when called with something other than an instance of an Exception will wrap it in an X::AdHoc and then throw it.
If you really want it to work more like Perl 5 you could do the following.
die "foo\n"; CATCH { when X::AdHoc { if .message.ends-with("\n") { note .message.chomp; # $*ERR.print( .message ) exit 1; } else { .rethrow; } } }
I would recommend against doing this as it could cause problems. For example you could set the environment variable RAKUDO_EXCEPTIONS_HANDLER to JSON, but the above would prevent it from intercepting the exception and outputting JSON.
|
|---|