mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 12:20:24 +00:00
Fix propagating the stacktrace on errors for OTP 19
This commit is contained in:
parent
5027d1335d
commit
1cc877b649
1 changed files with 6 additions and 0 deletions
|
@ -161,12 +161,18 @@ report_crash(Ref, StreamID, Pid, Reason, Stacktrace) ->
|
|||
%% @todo Better spec.
|
||||
-spec request_process(_, _, _) -> _.
|
||||
request_process(Req, Env, Middlewares) ->
|
||||
OTP = erlang:system_info(otp_release),
|
||||
try
|
||||
execute(Req, Env, Middlewares)
|
||||
catch
|
||||
exit:Reason ->
|
||||
Stacktrace = erlang:get_stacktrace(),
|
||||
erlang:raise(exit, {Reason, Stacktrace}, Stacktrace);
|
||||
%% OTP 19 does not propagate any exception stacktraces,
|
||||
%% we therefore add it for every class of exception.
|
||||
_:Reason when OTP =:= "19" ->
|
||||
Stacktrace = erlang:get_stacktrace(),
|
||||
erlang:raise(exit, {Reason, Stacktrace}, Stacktrace);
|
||||
Class:Reason ->
|
||||
erlang:raise(Class, Reason, erlang:get_stacktrace())
|
||||
end.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue