aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_http2.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2019-12-31 15:10:38 +0100
committerLoïc Hoguin <[email protected]>2019-12-31 15:10:38 +0100
commit3a7232b019f975a594a696eace46abcbfeec5b2e (patch)
treeadb3d7cb0d8bde26dc14a7d8c96af156ef3f37da /src/cowboy_http2.erl
parent3b85b808ae3cc48d19b71b72869ee59c25e70b00 (diff)
downloadcowboy-3a7232b019f975a594a696eace46abcbfeec5b2e.tar.gz
cowboy-3a7232b019f975a594a696eace46abcbfeec5b2e.tar.bz2
cowboy-3a7232b019f975a594a696eace46abcbfeec5b2e.zip
No longer use erlang:get_stacktrace/0
It has been deprecated in OTP and the new way is available on all supported OTP versions.
Diffstat (limited to 'src/cowboy_http2.erl')
-rw-r--r--src/cowboy_http2.erl24
1 files changed, 10 insertions, 14 deletions
diff --git a/src/cowboy_http2.erl b/src/cowboy_http2.erl
index 2754e9c..aa2dfbc 100644
--- a/src/cowboy_http2.erl
+++ b/src/cowboy_http2.erl
@@ -14,10 +14,6 @@
-module(cowboy_http2).
--ifdef(OTP_RELEASE).
--compile({nowarn_deprecated_function, [{erlang, get_stacktrace, 0}]}).
--endif.
-
-export([init/6]).
-export([init/10]).
-export([init/12]).
@@ -384,10 +380,10 @@ data_frame(State0=#state{opts=Opts, flow=Flow, streams=Streams}, StreamID, IsFin
flow=max(0, StreamFlow - Size), state=StreamState}}},
StreamID),
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),
reset_stream(State0, StreamID, {internal_error, {Class, Exception},
'Unhandled exception in cowboy_stream:data/4.'})
end;
@@ -491,10 +487,10 @@ headers_frame(State=#state{opts=Opts, streams=Streams}, StreamID, Req) ->
commands(State#state{
streams=Streams#{StreamID => #stream{state=StreamState}}},
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),
reset_stream(State, StreamID, {internal_error, {Class, Exception},
'Unhandled exception in cowboy_stream:init/3.'})
end.
@@ -518,10 +514,10 @@ early_error(State0=#state{ref=Ref, opts=Opts, peer=Peer},
try cowboy_stream:early_error(StreamID, Reason, PartialReq, Resp, Opts) of
{response, StatusCode, RespHeaders, RespBody} ->
send_response(State0, StreamID, StatusCode, RespHeaders, 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.
send_headers(State0, StreamID, fin, StatusCode0, RespHeaders0)
@@ -579,10 +575,10 @@ info(State=#state{opts=Opts, http2_machine=HTTP2Machine, streams=Streams}, Strea
{Commands, StreamState} ->
commands(State#state{streams=Streams#{StreamID => Stream#stream{state=StreamState}}},
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),
reset_stream(State, StreamID, {internal_error, {Class, Exception},
'Unhandled exception in cowboy_stream:info/3.'})
end;
@@ -1030,10 +1026,10 @@ terminate_stream(State=#state{flow=Flow, streams=Streams0, children=Children0},
terminate_stream_handler(#state{opts=Opts}, StreamID, Reason, StreamState) ->
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.
%% System callbacks.