diff options
author | Loïc Hoguin <[email protected]> | 2012-09-15 20:33:57 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2012-09-15 20:33:57 +0200 |
commit | bb4bd9ac96d5fde5e8183c9950d3642062347a45 (patch) | |
tree | 1ca6ecc5575355c6c2f197ab3b53f1f90f0b2809 /src/cowboy_websocket.erl | |
parent | 9b5cbb5000e564352afbd762c4ab0406250f147f (diff) | |
download | cowboy-bb4bd9ac96d5fde5e8183c9950d3642062347a45.tar.gz cowboy-bb4bd9ac96d5fde5e8183c9950d3642062347a45.tar.bz2 cowboy-bb4bd9ac96d5fde5e8183c9950d3642062347a45.zip |
Add a cowboy_req:to_list/1 function
Removes a lot of duplicate code when printing error messages.
Diffstat (limited to 'src/cowboy_websocket.erl')
-rw-r--r-- | src/cowboy_websocket.erl | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/cowboy_websocket.erl b/src/cowboy_websocket.erl index 8d40b73..182f80d 100644 --- a/src/cowboy_websocket.erl +++ b/src/cowboy_websocket.erl @@ -125,7 +125,7 @@ handler_init(State=#state{handler=Handler, opts=Opts}, upgrade_denied(Req2) catch Class:Reason -> upgrade_error(Req), - PLReq = lists:zip(record_info(fields, http_req), tl(tuple_to_list(Req))), + PLReq = cowboy_req:to_list(Req), error_logger:error_msg( "** Handler ~p terminating in websocket_init/3~n" " for the reason ~p:~p~n** Options were ~p~n" @@ -473,7 +473,7 @@ handler_call(State=#state{handler=Handler, opts=Opts}, Req, HandlerState, {shutdown, Req2, HandlerState2} -> websocket_close(State, Req2, HandlerState2, {normal, shutdown}) catch Class:Reason -> - PLReq = lists:zip(record_info(fields, http_req), tl(tuple_to_list(Req))), + PLReq = cowboy_req:to_list(Req), error_logger:error_msg( "** Handler ~p terminating in ~p/3~n" " for the reason ~p:~p~n** Message was ~p~n" @@ -523,7 +523,7 @@ handler_terminate(#state{handler=Handler, opts=Opts}, try Handler:websocket_terminate(TerminateReason, Req, HandlerState) catch Class:Reason -> - PLReq = lists:zip(record_info(fields, http_req), tl(tuple_to_list(Req))), + PLReq = cowboy_req:to_list(Req), error_logger:error_msg( "** Handler ~p terminating in websocket_terminate/3~n" " for the reason ~p:~p~n** Initial reason was ~p~n" |