aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLuca Favatella <[email protected]>2018-03-19 19:16:29 +0000
committerLuca Favatella <[email protected]>2018-03-23 17:00:42 +0000
commitc061eb5f8b6b0fdf3468945d8f6eea818ac4f478 (patch)
tree2cba9b7982bcd1d6586e56fa0ca9747d51845087 /lib
parent4868c38d1653ee9389ec024214509661818baf2a (diff)
downloadotp-c061eb5f8b6b0fdf3468945d8f6eea818ac4f478.tar.gz
otp-c061eb5f8b6b0fdf3468945d8f6eea818ac4f478.tar.bz2
otp-c061eb5f8b6b0fdf3468945d8f6eea818ac4f478.zip
inets: Make httpc error reason more informative for unexpected errors
Diffstat (limited to 'lib')
-rw-r--r--lib/inets/src/http_client/httpc_handler.erl20
1 files changed, 12 insertions, 8 deletions
diff --git a/lib/inets/src/http_client/httpc_handler.erl b/lib/inets/src/http_client/httpc_handler.erl
index 8311d1ed76..0ca8155054 100644
--- a/lib/inets/src/http_client/httpc_handler.erl
+++ b/lib/inets/src/http_client/httpc_handler.erl
@@ -253,8 +253,9 @@ handle_call(Request, From, State) ->
Result ->
Result
catch
- _:Reason ->
- {stop, {shutdown, Reason} , State}
+ Class:Reason ->
+ ST = erlang:get_stacktrace(),
+ {stop, {shutdown, {{Class, Reason}, ST}}, State}
end.
@@ -269,8 +270,9 @@ handle_cast(Msg, State) ->
Result ->
Result
catch
- _:Reason ->
- {stop, {shutdown, Reason} , State}
+ Class:Reason ->
+ ST = erlang:get_stacktrace(),
+ {stop, {shutdown, {{Class, Reason}, ST}}, State}
end.
%%--------------------------------------------------------------------
@@ -284,8 +286,9 @@ handle_info(Info, State) ->
Result ->
Result
catch
- _:Reason ->
- {stop, {shutdown, Reason} , State}
+ Class:Reason ->
+ ST = erlang:get_stacktrace(),
+ {stop, {shutdown, {{Class, Reason}, ST}}, State}
end.
%%--------------------------------------------------------------------
@@ -569,11 +572,12 @@ do_handle_info({Proto, _Socket, Data},
activate_once(Session),
{noreply, State#state{mfa = NewMFA}}
catch
- _:Reason ->
+ Class:Reason ->
+ ST = erlang:get_stacktrace(),
ClientReason = {could_not_parse_as_http, Data},
ClientErrMsg = httpc_response:error(Request, ClientReason),
NewState = answer_request(Request, ClientErrMsg, State),
- {stop, {shutdown, Reason}, NewState}
+ {stop, {shutdown, {{Class, Reason}, ST}}, NewState}
end;
do_handle_info({Proto, Socket, Data},