websocket: default to error code 500 on any websocket error

This commit is contained in:
Luna 2019-06-11 18:00:36 -03:00
parent 19bc38b881
commit 2f9f859be9

View file

@ -39,13 +39,13 @@ module Kemal
@proc.call(socket, context)
socket.run
rescue error : Exception
# TODO: check if 500 is what we're supposed to give
context.response.status_code = 500
if error.is_a?(WebsocketError)
# TODO
context.response.status_code = 500
code = error.code.to_i16
message = error.status_message
else
context.response.status_code = error.code
code = 1011_i16
message = "Exception"
end