-
Notifications
You must be signed in to change notification settings - Fork 292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarify how control flow is handled in CATCH blocks #3325
base: main
Are you sure you want to change the base?
Conversation
doc/Language/exceptions.pod6
Outdated
categories of exceptions inside a C<when> 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... "make them look alike"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a strange paragraph... I think what it's trying to say that other exception types won't match simply because they're in the X
namespace, but I don't think explaining how roles can be used with exceptions really fits on this part of the page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was saying "will look alike" would be better as "will make them look alike". Not getting into anything else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please check this?
doc/Language/exceptions.pod6
Outdated
|
||
To handle all exceptions, use a C<default> statement. This example prints out | ||
almost the same information as the normal backtrace printer. | ||
A X<C<CATCH>|CATCH> block places any exception thrown in its topic |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The anchor to CATCH
will be right here. Are you sure this is the best place? Or wouldn't it better to use CATCH block for indexing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this belongs more on the phasers page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then it's better if you move the X thingie
doc/Language/exceptions.pod6
Outdated
control flow in one from reaching its end where, unless the exception | ||
has been L<resumed|#Resuming_of_exceptions>, the exception will continue | ||
to be thrown. Allowing this can be used for logging purposes, for | ||
instance: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
up to where? The end of the catch block?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. "the end of the block" might be clearer than "its end" here.
This fits more on the phasers page, which already has one anyway.
Converting to draft - been a long time since comments were made, not addressed, need to finalize or reject. |
The problem
The documentation on catching exceptions is rather unclear:
CATCH
is explained in terms ofgiven
/when
, even though it's not particularly special when it comes to blocks.CATCH
block isn't very clear, despite it being useful not to usedefault
orwhen
in one in some cases.Solution provided
CATCH
in terms of blocks.CATCH
block and provide an example of when this can be useful.