Rethrow errors so they may be handled outside of WebSocket.open() #1069
Open
bryaan wants to merge 1 commit intoJuliaWeb:masterfrom
Open
Rethrow errors so they may be handled outside of WebSocket.open() #1069bryaan wants to merge 1 commit intoJuliaWeb:masterfrom
bryaan wants to merge 1 commit intoJuliaWeb:masterfrom
Conversation
| close(ws, CloseFrameBody(1008, "Unexpected client websocket error")) | ||
| end | ||
| end | ||
| rethrow(e) |
Collaborator
There was a problem hiding this comment.
is rethrow() fine here?
Suggested change
| rethrow(e) | |
| rethrow() |
I think rethrow(e) is not usually the right choice, per the docs:
help?> rethrow
search: rethrow
rethrow()
Rethrow the current exception from within a catch block. The rethrown exception will continue propagation as if it had not been caught.
│ Note
│
│ The alternative form rethrow(e) allows you to associate an alternative exception object e with the current backtrace. However this
│ misrepresents the program state at the time of the error so you're encouraged to instead throw a new exception using throw(e). In Julia
│ 1.1 and above, using throw(e) will preserve the root cause exception on the stack, as described in current_exceptions.
Member
There was a problem hiding this comment.
I think we should actually do the rethrowing from inside the !isok block above, since we're currently "throwing" a "closed normally" exception when we get a close notification from the peer socket.
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.
This is a fix for a bug where any errors throw from within WebSocket.open() is hidden from an outer try/catch.
#1067