aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_http.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/cowboy_http.erl')
-rw-r--r--src/cowboy_http.erl24
1 files changed, 10 insertions, 14 deletions
diff --git a/src/cowboy_http.erl b/src/cowboy_http.erl
index f128a44..90e3203 100644
--- a/src/cowboy_http.erl
+++ b/src/cowboy_http.erl
@@ -14,10 +14,6 @@
-module(cowboy_http).
--ifdef(OTP_RELEASE).
--compile({nowarn_deprecated_function, [{erlang, get_stacktrace, 0}]}).
--endif.
-
-export([init/6]).
-export([system_continue/3]).
@@ -335,10 +331,10 @@ after_parse({request, Req=#{streamid := StreamID, method := Method,
end,
State = set_timeout(State1, idle_timeout),
parse(Buffer, commands(State, StreamID, Commands))
- catch Class:Exception ->
+ catch Class:Exception:Stacktrace ->
cowboy:log(cowboy_stream:make_error_log(init,
[StreamID, Req, Opts],
- Class, Exception, erlang:get_stacktrace()), Opts),
+ Class, Exception, Stacktrace), Opts),
early_error(500, State0, {internal_error, {Class, Exception},
'Unhandled exception in cowboy_stream:init/3.'}, Req),
parse(Buffer, State0)
@@ -357,10 +353,10 @@ after_parse({data, StreamID, IsFin, Data, State0=#state{opts=Opts, buffer=Buffer
end),
State = update_flow(IsFin, Data, State1#state{streams=Streams}),
parse(Buffer, commands(State, StreamID, Commands))
- catch Class:Exception ->
+ catch Class:Exception:Stacktrace ->
cowboy:log(cowboy_stream:make_error_log(data,
[StreamID, IsFin, Data, StreamState0],
- Class, Exception, erlang:get_stacktrace()), Opts),
+ Class, Exception, Stacktrace), Opts),
%% @todo Should call parse after this.
stream_terminate(State0, StreamID, {internal_error, {Class, Exception},
'Unhandled exception in cowboy_stream:data/4.'})
@@ -904,10 +900,10 @@ info(State=#state{opts=Opts, streams=Streams0}, StreamID, Msg) ->
Streams = lists:keyreplace(StreamID, #stream.id, Streams0,
Stream#stream{state=StreamState}),
commands(State#state{streams=Streams}, StreamID, Commands)
- catch Class:Exception ->
+ catch Class:Exception:Stacktrace ->
cowboy:log(cowboy_stream:make_error_log(info,
[StreamID, Msg, StreamState0],
- Class, Exception, erlang:get_stacktrace()), Opts),
+ Class, Exception, Stacktrace), Opts),
stream_terminate(State, StreamID, {internal_error, {Class, Exception},
'Unhandled exception in cowboy_stream:info/3.'})
end;
@@ -1286,10 +1282,10 @@ stream_terminate(State0=#state{opts=Opts, in_streamid=InStreamID, in_state=InSta
stream_call_terminate(StreamID, Reason, StreamState, #state{opts=Opts}) ->
try
cowboy_stream:terminate(StreamID, Reason, StreamState)
- catch Class:Exception ->
+ catch Class:Exception:Stacktrace ->
cowboy:log(cowboy_stream:make_error_log(terminate,
[StreamID, Reason, StreamState],
- Class, Exception, erlang:get_stacktrace()), Opts)
+ Class, Exception, Stacktrace), Opts)
end.
maybe_req_close(#state{opts=#{http10_keepalive := false}}, _, 'HTTP/1.0') ->
@@ -1386,10 +1382,10 @@ early_error(StatusCode0, #state{socket=Socket, transport=Transport,
%% @todo Technically we allow the sendfile tuple.
RespBody
])
- catch Class:Exception ->
+ catch Class:Exception:Stacktrace ->
cowboy:log(cowboy_stream:make_error_log(early_error,
[StreamID, Reason, PartialReq, Resp, Opts],
- Class, Exception, erlang:get_stacktrace()), Opts),
+ Class, Exception, Stacktrace), Opts),
%% We still need to send an error response, so send what we initially
%% wanted to send. It's better than nothing.
Transport:send(Socket, cow_http:response(StatusCode0,