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

chore(protocol): list raised exceptions in handlers #1250

Closed
wants to merge 2 commits into from

Conversation

vladopajic
Copy link
Member

@vladopajic vladopajic commented Feb 12, 2025

part of #962 effort.

Comment on lines +180 to 183
proc handler(conn: Connection, proto: string) {.async: (raises: [CancelledError]).} =
## main protocol handler that gets triggered on every
## connection for a protocol string
## e.g. ``/floodsub/1.0.0``, etc...
Copy link
Member Author

Choose a reason for hiding this comment

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

here CancelledError has to be raised because it is handler, but this handler is catching this exception.

Copy link
Contributor

Choose a reason for hiding this comment

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

it might be a good idea to review whether the handler should catch the cancellation or let it propagate - much of this code was written as cancellation was being developed and it might not always be following best practice .. catching the cancellation and translating it to some other outcome is sometimes the right thing, but often not (it "hides" the fact that a cancellation is ongoing from the calling code which deprives it of the means to make the distinction).

Copy link
Member Author

Choose a reason for hiding this comment

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

hey @arnetheduck, yes, it makes much more sense to catch cancellation. this effort is in #1260

@vladopajic vladopajic marked this pull request as draft February 12, 2025 16:22
@richard-ramos
Copy link
Member

Looks good so far. CI seems to be complaining tho.

@vladopajic vladopajic changed the title chore: list raised exceptions in protocol handlers chore(protocol): list raised exceptions in handlers Feb 14, 2025
@vladopajic
Copy link
Member Author

closing this PR in favor of #1260

@vladopajic vladopajic closed this Feb 18, 2025
@vladopajic vladopajic deleted the raises-protocols-handler branch February 24, 2025 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: done
Development

Successfully merging this pull request may close these issues.

3 participants