websocket: default to error code 500 on any websocket error
This commit is contained in:
parent
19bc38b881
commit
2f9f859be9
1 changed files with 3 additions and 3 deletions
|
@ -39,13 +39,13 @@ module Kemal
|
||||||
@proc.call(socket, context)
|
@proc.call(socket, context)
|
||||||
socket.run
|
socket.run
|
||||||
rescue error : Exception
|
rescue error : Exception
|
||||||
if error.is_a?(WebsocketError)
|
# TODO: check if 500 is what we're supposed to give
|
||||||
# TODO
|
|
||||||
context.response.status_code = 500
|
context.response.status_code = 500
|
||||||
|
|
||||||
|
if error.is_a?(WebsocketError)
|
||||||
code = error.code.to_i16
|
code = error.code.to_i16
|
||||||
message = error.status_message
|
message = error.status_message
|
||||||
else
|
else
|
||||||
context.response.status_code = error.code
|
|
||||||
code = 1011_i16
|
code = 1011_i16
|
||||||
message = "Exception"
|
message = "Exception"
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue