Skip to content

Commit 7a913fb

Browse files
authored
Updated: Rethrow errors so they may be handled outside of WebSocket.open() (#1072)
* Rethrow error in websocket * Don't throw when closed normally https://github.com/JuliaWeb/HTTP.jl/pull/1069/files#r1247308928 * Also rethrow when upgrading websocket
1 parent 4693a9b commit 7a913fb

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/WebSockets.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,9 @@ function open(f::Function, url; suppress_close_error::Bool=false, verbose=false,
385385
close(ws, CloseFrameBody(1008, "Unexpected client websocket error"))
386386
end
387387
end
388+
if !isok(e)
389+
rethrow()
390+
end
388391
finally
389392
if !isclosed(ws)
390393
close(ws, CloseFrameBody(1000, ""))
@@ -452,6 +455,9 @@ function upgrade(f::Function, http::Streams.Stream; suppress_close_error::Bool=f
452455
close(ws, CloseFrameBody(1011, "Unexpected server websocket error"))
453456
end
454457
end
458+
if !isok(e)
459+
rethrow()
460+
end
455461
finally
456462
if !isclosed(ws)
457463
close(ws, CloseFrameBody(1000, ""))

0 commit comments

Comments
 (0)