Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Reflow and some clarifications
  • Loading branch information
JJ committed May 17, 2019
1 parent 7b9506c commit 7bc42b8
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions doc/Language/exceptions.pod6
Expand Up @@ -11,9 +11,9 @@ an exception objects store is, for instance, a human-readable message
about the error condition, the backtrace of the raising of the error,
and so on.
All built-in exceptions inherit from L<Exception|/type/Exception>, which provides some basic
behavior, including the storage of a backtrace and an interface for the
backtrace printer.
All built-in exceptions inherit from L<Exception|/type/Exception>, which
provides some basic behavior, including the storage of a backtrace and an
interface for the backtrace printer.
=head1 I<Ad hoc> exceptions
Expand Down Expand Up @@ -213,8 +213,7 @@ 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
Expand All @@ -235,7 +234,8 @@ value of the expression or L<Nil|/type/Nil> if an exception was thrown.
}
# OUTPUT: «not my number!␤»
C<try> can also be used with a statement instead of a block:
C<try> can also be used with a statement instead of a block, that is, as a
L<statement prefix|/language/statement-prefixes#try>:
=begin code
say try "some-filename.txt".IO.slurp // "sane default";
Expand Down Expand Up @@ -390,10 +390,12 @@ and are handled either automatically or by the appropriate
L<phaser|/language/phasers#Loop_phasers>. Any unhandled control exception is
converted to a normal exception.
{ return; CATCH { default { $*ERR.say: .^name, ': ',.Str } } }
=begin code
{ return; CATCH { default { $*ERR.say: .^name, ': ',.Str } } }
# OUTPUT: «X::ControlFlow::Return: Attempt to return outside of any Routine␤»
# was CX::Return
# OUTPUT: «X::ControlFlow::Return: Attempt to return outside of any Routine␤»
# was CX::Return
=end code
=end pod

Expand Down

0 comments on commit 7bc42b8

Please sign in to comment.