fix(webtransport-websys): handle exceptions in WebTransport::close#5390
Merged
mergify[bot] merged 7 commits intolibp2p:masterfrom May 17, 2024
Merged
Conversation
885050a to
ae56647
Compare
oblique
approved these changes
May 16, 2024
jxs
previously approved these changes
May 17, 2024
Member
|
Thanks for the fix! And thanks @oblique for the review ❤️ |
Approvals have been dismissed because the PR was updated after the send-it label was applied.
4 tasks
jxs
approved these changes
May 17, 2024
4 tasks
TimTinkers
pushed a commit
to unattended-backpack/rust-libp2p
that referenced
this pull request
Sep 14, 2024
libc 0.2.154 is version is not published in crates.io and it breaks the build. The CI of libp2p#5390 fails because of this. Pull-Request: libp2p#5395.
TimTinkers
pushed a commit
to unattended-backpack/rust-libp2p
that referenced
this pull request
Sep 14, 2024
Calls to `close` can result in exceptions being thrown eg. when the connection is not yet fully initialized (in `connecting` state). Currently webtransport-websys doesn't catch those resulting in errors like:
```
Uncaught (in promise)
WebTransportError { source: "session", streamErrorCode: null, name: "WebTransportError", message: "remote WebTransport close", code: 0, result: 0, filename: "", lineNumber: 0, columnNumber: 0, data: null }
```
Those cannot be caught even by wrapping `.close()` in the `try { ... } catch () {...}` blocks. It's rather poorly documented, indirectly with just an example [here](https://developer.mozilla.org/en-US/docs/Web/API/WebTransport/closed), but the way to catch those is through the promise created by `.closed`.
Pull-Request: libp2p#5390.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Calls to
closecan result in exceptions being thrown eg. when the connection is not yet fully initialized (inconnectingstate). Currently webtransport-websys doesn't catch those resulting in errors like:Those cannot be caught even by wrapping
.close()in thetry { ... } catch () {...}blocks. It's rather poorly documented, indirectly with just an example here, but the way to catch those is through the promise created by.closed.Notes & open questions
Change checklist