0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-16 05:00:24 +00:00

Exit with exit/1 on handler exception and include class in reason

This commit is contained in:
James Fish 2015-05-06 16:21:14 +01:00
parent 1f5b19a0b7
commit 2718698895
4 changed files with 15 additions and 10 deletions

View file

@ -350,14 +350,15 @@ handler_call(State=#state{handler=Handler}, Req, HandlerState,
websocket_close(State, Req2, HandlerState2, stop)
catch Class:Reason ->
_ = websocket_close(State, Req, HandlerState, {crash, Class, Reason}),
erlang:Class([
exit({cowboy_handler, [
{class, Class},
{reason, Reason},
{mfa, {Handler, Callback, 3}},
{stacktrace, erlang:get_stacktrace()},
{msg, Message},
{req, cowboy_req:to_list(Req)},
{state, HandlerState}
])
]})
end.
-spec websocket_send(cow_ws:frame(), #state{}) -> ok | stop | {error, atom()}.