Skip to content
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

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Kaiepi
Copy link
Collaborator

@Kaiepi Kaiepi commented Apr 11, 2020

The problem

The documentation on catching exceptions is rather unclear:

  • A paragraph explaining how a role is used in an example is placed after what's presumably another example added later on.
  • How exceptions are handled in CATCH is explained in terms of given/when, even though it's not particularly special when it comes to blocks.
  • What happens when control flow is allowed to reach the end of a CATCH block isn't very clear, despite it being useful not to use default or when in one in some cases.

Solution provided

  • Move that paragraph to the correct place.
  • Describe CATCH in terms of blocks.
  • Explain what happens when you allow the control flow to reach the end of a CATCH block and provide an example of when this can be useful.

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... "make them look alike"?

Copy link
Collaborator Author

@Kaiepi Kaiepi Apr 14, 2020

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.

Copy link
Contributor

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.

Copy link
Contributor

@JJ JJ left a 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?


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
Copy link
Contributor

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?

Copy link
Collaborator Author

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.

Copy link
Contributor

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

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:
Copy link
Contributor

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?

Copy link
Collaborator Author

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.

@coke coke marked this pull request as draft April 16, 2022 16:47
@coke
Copy link
Collaborator

coke commented Apr 16, 2022

Converting to draft - been a long time since comments were made, not addressed, need to finalize or reject.

@coke coke self-assigned this Feb 2, 2023
@coke coke added this to the 2023-First Quarter milestone Feb 7, 2023
@coke coke removed their assignment Mar 4, 2023
@coke coke modified the milestones: 2023-Quarter 1, 2023-Quarter 2 Apr 1, 2023
@coke coke modified the milestones: 2023-Quarter 2, 2023-Quarter 3 Jul 12, 2023
@coke coke modified the milestones: 2023-Quarter 3, 2023-Quarter 4 Oct 8, 2023
@coke coke modified the milestones: 2023-Quarter 4, 2024-Quarter-2 Mar 31, 2024
@coke coke modified the milestones: 2024-Quarter-2, 2024-Quarter 3 Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants