Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
Showing
1 changed file
with
16 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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» | ||
|
|
@@ -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. | ||
|
|
@@ -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> | ||
|
|
@@ -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 { | ||
|
|
@@ -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.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
tisonkun
Member
|
||
| Exceptions interrupt control flow and divert it away from the statement | ||
| following the statement that threw it. Any exception handled by the | ||
|
|
@@ -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 | ||
|
|
@@ -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 | ||
|
|
||
Is there a style guide say we prefer not to capitalize letter in the middle of phrase?