aboutsummaryrefslogtreecommitdiffstats
path: root/lib/inets/src/http_client/httpc_handler.erl
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2012-05-22 17:37:33 +0200
committerMicael Karlberg <[email protected]>2012-05-22 17:37:33 +0200
commit022bc68b6dd10624b58779dc2b3b0e392e3e04f5 (patch)
tree60c818aef959b24f83a21b857dc906406b3c16d9 /lib/inets/src/http_client/httpc_handler.erl
parentef14221acafe78b7a77b5d42b6a615fa7333750d (diff)
downloadotp-022bc68b6dd10624b58779dc2b3b0e392e3e04f5.tar.gz
otp-022bc68b6dd10624b58779dc2b3b0e392e3e04f5.tar.bz2
otp-022bc68b6dd10624b58779dc2b3b0e392e3e04f5.zip
[inets/httpc] Better handling of session db update failure
A failure to update the session database will now result in an informative error message and a controlled (handler) exit rather then an ugly crash. Also debug functions to retrieve sessions info and updated the info function with more info (sessions and options). OTP-10093
Diffstat (limited to 'lib/inets/src/http_client/httpc_handler.erl')
-rw-r--r--lib/inets/src/http_client/httpc_handler.erl27
1 files changed, 26 insertions, 1 deletions
diff --git a/lib/inets/src/http_client/httpc_handler.erl b/lib/inets/src/http_client/httpc_handler.erl
index b8c34bd99b..6fe05dec80 100644
--- a/lib/inets/src/http_client/httpc_handler.erl
+++ b/lib/inets/src/http_client/httpc_handler.erl
@@ -1713,7 +1713,32 @@ update_session(ProfileName, #session{id = SessionId} = Session, Pos, Value) ->
catch
error:undef -> % This could happen during code upgrade
Session2 = erlang:setelement(Pos, Session, Value),
- insert_session(Session2, ProfileName)
+ insert_session(Session2, ProfileName);
+ T:E ->
+ error_logger:error_msg("Failed updating session: "
+ "~n ProfileName: ~p"
+ "~n SessionId: ~p"
+ "~n Pos: ~p"
+ "~n Value: ~p"
+ "~nwhen"
+ "~n Session (db) info: ~p"
+ "~n Session (db): ~p"
+ "~n Session (record): ~p"
+ "~n T: ~p"
+ "~n E: ~p",
+ [ProfileName, SessionId, Pos, Value,
+ (catch httpc_manager:which_session_info(ProfileName)),
+ Session,
+ (catch httpc_manager:lookup_session(ProfileName, SessionId)),
+ T, E]),
+ exit({failed_updating_session,
+ [{profile, ProfileName},
+ {session_id, SessionId},
+ {pos, Pos},
+ {value, Value},
+ {etype, T},
+ {error, E},
+ {stacktrace, erlang:get_stacktrace()}]})
end.