Skip to content

Commit 28d8512

Browse files
committed
Add a $*ERR.say on a simple catch block as example of how to use STDERR.
See discussion in issue #1722.
1 parent 0cfb87f commit 28d8512

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

doc/Language/exceptions.pod6

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ It's possible to handle exceptional circumstances by supplying a C<CATCH> block:
5252
die X::IO::DoesNotExist.new(:path("foo/bar"), :trying("zombie copy"));
5353
5454
CATCH {
55-
when X::IO { say "some kind of IO exception was caught!" }
55+
when X::IO { $*ERR.say: "some kind of IO exception was caught!" }
5656
}
5757
5858
# RESULT: «some kind of IO exception was caught!»
5959
6060
Here, we are saying that if any exception of type C<X::IO> occurs, then the
61-
message C<some kind of IO exception was caught!> will be displayed.
61+
message C<some kind of IO exception was caught!> will be sent to I<stderr> and displayed.
6262
6363
A X<C<CATCH>|CATCH> block uses smart matching similar to how C<given/when> smart
6464
matches on options, thus it's possible to catch and handle various categories of

0 commit comments

Comments
 (0)