aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_protocol.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2012-09-15 20:33:57 +0200
committerLoïc Hoguin <[email protected]>2012-09-15 20:33:57 +0200
commitbb4bd9ac96d5fde5e8183c9950d3642062347a45 (patch)
tree1ca6ecc5575355c6c2f197ab3b53f1f90f0b2809 /src/cowboy_protocol.erl
parent9b5cbb5000e564352afbd762c4ab0406250f147f (diff)
downloadcowboy-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_protocol.erl')
-rw-r--r--src/cowboy_protocol.erl8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/cowboy_protocol.erl b/src/cowboy_protocol.erl
index 089cbbc..bc56e76 100644
--- a/src/cowboy_protocol.erl
+++ b/src/cowboy_protocol.erl
@@ -287,7 +287,7 @@ handler_init(Req, State=#state{transport=Transport,
upgrade_protocol(Req, State, Module)
catch Class:Reason ->
error_terminate(500, State),
- 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 init/3~n"
" for the reason ~p:~p~n"
@@ -310,7 +310,7 @@ handler_handle(HandlerState, Req, State=#state{handler={Handler, Opts}}) ->
{ok, Req2, HandlerState2} ->
terminate_request(HandlerState2, Req2, State)
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 handle/2~n"
" for the reason ~p:~p~n"
@@ -368,7 +368,7 @@ handler_call(HandlerState, Req, State=#state{handler={Handler, Opts}},
handler_before_loop(HandlerState2, Req2,
State#state{hibernate=true})
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 info/3~n"
" for the reason ~p:~p~n"
@@ -385,7 +385,7 @@ handler_terminate(HandlerState, Req, #state{handler={Handler, Opts}}) ->
try
Handler:terminate(Req#http_req{resp_state=locked}, 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 terminate/2~n"
" for the reason ~p:~p~n"