mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-15 12:40:25 +00:00
Let the stream handler take care of crash handling and logging
This commit is contained in:
parent
e30d120bd8
commit
9966df9ad4
5 changed files with 22 additions and 57 deletions
|
@ -369,15 +369,7 @@ 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}),
|
||||
exit({cowboy_handler, [
|
||||
{class, Class},
|
||||
{reason, Reason},
|
||||
{mfa, {Handler, Callback, 3}},
|
||||
{stacktrace, erlang:get_stacktrace()},
|
||||
{msg, Message},
|
||||
{req, Req},
|
||||
{state, HandlerState}
|
||||
]})
|
||||
erlang:raise(Class, Reason, erlang:get_stacktrace())
|
||||
end.
|
||||
|
||||
-spec websocket_send(cow_ws:frame(), #state{}) -> ok | stop | {error, atom()}.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue