Skip to content

Commit

Permalink
Reflow
Browse files Browse the repository at this point in the history
  • Loading branch information
JJ committed Jan 3, 2019
1 parent 2f9ac56 commit 0304aaf
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions doc/Language/exceptions.pod6
Expand Up @@ -168,8 +168,9 @@ try {
=end code
X<|resume (Exceptions)>
In both C<try> blocks above, exceptions will be contained within the block, but
the C<say> statement will not be run. We can handle them, though:
In both C<try> blocks above, exceptions will be contained within the
block, but the C<say> statement will not be run. We can handle them,
though:
class E is Exception { method message() { "Just stop already!" } }
Expand Down Expand Up @@ -205,24 +206,27 @@ Which would output:
in block <unit> at exception.p6 line 21
=end code
Since the C<CATCH> block is handling just the C<X::AdHoc> exception thrown by
the C<die> statement, but not the C<E> exception. In the absence of a C<CATCH>
block, all exceptions will be contained and dropped, as indicated above.
C<resume> will resume execution right after the exception has been thrown; in
this case, in the C<die> statement. Please consult the section on
Since the C<CATCH> block is handling just the C<X::AdHoc> exception
thrown by the C<die> statement, but not the C<E> exception. In the
absence of a C<CATCH> block, all exceptions will be contained and
dropped, as indicated above. C<resume> will resume execution right after
the exception has been thrown; in this case, in the C<die> statement.
Please consult the section on
L<resuming of exceptions|/language/exceptions#Resuming_of_exceptions>
for more information on this.
for more
information on this.
A C<try>-block is a normal block and as such treats its last statement as the
return value of itself. We can therefore use it as a right-hand side.
A C<try>-block is a normal block and as such treats its last statement
as the return value of itself. We can therefore use it as a right-hand
side.
=begin code
say try { +"99999" } // "oh no"; # OUTPUT: «99999␤»
say try { +"hello" } // "oh no"; # OUTPUT: «oh no␤»
=end code
Try blocks support C<else> blocks indirectly by returning the return value of
the expression or L<Nil|/type/Nil> if an exception was thrown.
Try blocks support C<else> blocks indirectly by returning the return
value of the expression or L<Nil|/type/Nil> if an exception was thrown.
with try +"♥" {
say "this is my number: $_"
Expand Down Expand Up @@ -393,4 +397,4 @@ converted to a normal exception.
=end pod

# vim: expandtab softtabstop=4 shiftwidth=4 ft=perl6
# vim: expandtab softtabstop=4 shiftwidth=4 ft=perl6

0 comments on commit 0304aaf

Please sign in to comment.