Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
General revision of the Exceptions page
Reflow, elimination of capitals and stuff, but also eliminates the Try
category (refs #1410) and the incorrect indexing of Try. This would
close the nicely numbered 2222 issue: closes #2222
  • Loading branch information
JJ committed Jul 27, 2018
1 parent 5a4d7cf commit e85d8d1
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions doc/Language/exceptions.pod6
Expand Up @@ -14,13 +14,12 @@ All built-in exceptions inherit from L<Exception>, which provides some basic
behavior, including the storage of a backtrace and an interface for the
backtrace printer.
=head1 Ad hoc exceptions
=head1 I<Ad hoc> exceptions
Ad hoc exceptions can be used by calling L<die|/routine/die> with
a description of the error:
die "oops, something went wrong";
# RESULT: «oops, something went wrong in block <unit> at my-script.p6:1␤»
Expand Down Expand Up @@ -81,11 +80,11 @@ almost the same information as the normal backtrace printer.
}
}
Note that the match target is a role. To allow user defined exceptions
to match in the same manner, they must implement the given role. Just existing
in the same namespace will look alike but won't match in a C<CATCH> block.
Note that the match target is a role. To allow user defined exceptions to match
in the same manner, they must implement the given role. Just existing in the
same namespace will look alike but won't match in a C<CATCH> block.
=head2 Exception handlers and enclosing blocks.
=head2 Exception handlers and enclosing blocks
After a CATCH has handled the exception, the block enclosing the C<CATCH> block
is exited.
Expand Down Expand Up @@ -118,9 +117,11 @@ Compare with this:
say "Hi! I am at the outer block!"; # OUTPUT: «Hi! I am at the outer block!␤»
See "Resuming of Exceptions", for how to return control back to where the exception originated.
See L<Resuming of exceptions|/language/exceptions#Resuming_of_exceptions>, for
how to return control back to where the exception originated.
=head1 X<C<try>|try>
X<|try blocks>
=head1 C<try> blocks
A C<try> block is a normal block with the
L<C<use fatal> pragma|/language/pragmas#index-entry-fatal-fatal>
Expand All @@ -139,10 +140,10 @@ try {
}
=end code
Any exception that is thrown in such a block
will be caught by the implicit C<CATCH> block or a C<CATCH> block provided by
the user. In the latter case, any unhandled exception will be rethrown. If
you choose not to handle the exception, they will be contained by the block.
Any exception that is thrown in such a block will be caught by the implicit
C<CATCH> block or a C<CATCH> block provided by the user. In the latter case, any
unhandled exception will be rethrown. If you choose not to handle the exception,
they will be contained by the block.
=begin code
try {
Expand Down Expand Up @@ -304,7 +305,7 @@ C<throw> can be viewed as the method form of C<die>, just that in this
particular case, the sub and method forms of the routine have different
names.
=head1 Resuming of Exceptions
=head1 Resuming of exceptions

This comment has been minimized.

Copy link
@tisonkun

tisonkun Jul 27, 2018

Member

Is there a style guide say we prefer not to capitalize letter in the middle of phrase?

This comment has been minimized.

Copy link
@tisonkun

tisonkun Jul 27, 2018

Member

I am ok with this, but if we want to global consistent it, let's make it documented

This comment has been minimized.

Copy link
@JJ

JJ via email Jul 27, 2018

Author Contributor

This comment has been minimized.

Copy link
@JJ

JJ via email Jul 27, 2018

Author Contributor

This comment has been minimized.

Copy link
@JJ

JJ via email Jul 27, 2018

Author Contributor

This comment has been minimized.

Copy link
@JJ

JJ via email Jul 27, 2018

Author Contributor
Exceptions interrupt control flow and divert it away from the statement
following the statement that threw it. Any exception handled by the
Expand Down Expand Up @@ -350,7 +351,7 @@ is taking no effect, since the C<CATCH> statement is happening I<inside> the
call to C<bad-sub>, which, via the C<return> statement, assigns the C<not
returning> value to it.
=head1 Uncaught Exceptions
=head1 Uncaught exceptions
If an exception is thrown and not caught, it causes the program to exit with a
non-zero status code, and typically prints a message to the standard error
Expand All @@ -367,7 +368,7 @@ printing a backtrace along with the message:
# prints "message\n" to $*ERR and exits, no backtrace
=head1 Control Exceptions
=head1 Control exceptions
Control exceptions are thrown by certain L<keywords|/language/phasers#CONTROL>
and are handled either automatically or by the appropriate
Expand Down

0 comments on commit e85d8d1

Please sign in to comment.