Skip to content

Commit d0dae21

Browse files
committed
Mention way to suppress backtrace
1 parent 568651e commit d0dae21

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

doc/Language/exceptions.pod

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,22 @@ method C<.resume> on the exception object.
164164
165165
say "We have continued with control flow."; # this is step 3
166166
167+
=head2 Uncaught Exceptions
168+
169+
If an exception is thrown and not caught, it causes the program to exit with a
170+
non-zero status code, and typically prints a message to the standard error
171+
stream of the program. This message is obtained by calling the C<gist> method
172+
on the exception object. You can use this to suppress the default behavior of
173+
printing a backtrace along with the message:
174+
175+
class X::WithoutLineNumber is X::AdHoc {
176+
multi method gist(X::WithoutLineNumber:D:) {
177+
$.payload
178+
}
179+
}
180+
die X::WithoutLineNumber.new(payload => "message")
181+
# prints "message\n" to $*ERR and exits, no backtrace
182+
167183
=end pod
168184

169185
# vim: expandtab shiftwidth=4 ft=perl6

0 commit comments

Comments
 (0)