Log HTTP handler exceptions

This commit is contained in:
Alexey Shchepin 2023-01-26 02:47:34 +03:00
parent 03cbc9b004
commit f650b1e83c
1 changed files with 9 additions and 1 deletions

View File

@ -370,7 +370,15 @@ process(Handlers, Request) ->
HandlerModule:socket_handoff(
LocalPath, Request, HandlerOpts);
false ->
HandlerModule:process(LocalPath, Request)
try
HandlerModule:process(LocalPath, Request)
catch
Class:Reason:Stack ->
?ERROR_MSG(
"HTTP handler crashed: ~s",
[misc:format_exception(2, Class, Reason, Stack)]),
erlang:raise(Class, Reason, Stack)
end
end,
ejabberd_hooks:run(http_request_debug, [{LocalPath, Request}]),
R;