File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -164,6 +164,22 @@ method C<.resume> on the exception object.
164
164
165
165
say "We have continued with control flow."; # this is step 3
166
166
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
+
167
183
= end pod
168
184
169
185
# vim: expandtab shiftwidth=4 ft=perl6
You can’t perform that action at this time.
0 commit comments