aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2014-06-30 17:36:43 +0200
committerLoïc Hoguin <[email protected]>2014-06-30 17:36:43 +0200
commit8cc353114eea7113878463a934baf068ee255cb5 (patch)
tree439c75aab76a659d73f7fb68cc9dfea60e0bbe8a
parentbc3b122e8912c04512f0935dda7b70cae6d09ce1 (diff)
downloadcowboy-8cc353114eea7113878463a934baf068ee255cb5.tar.gz
cowboy-8cc353114eea7113878463a934baf068ee255cb5.tar.bz2
cowboy-8cc353114eea7113878463a934baf068ee255cb5.zip
Update specs that were too wide
-rw-r--r--src/cowboy_handler.erl22
-rw-r--r--src/cowboy_rest.erl3
-rw-r--r--src/cowboy_websocket.erl5
3 files changed, 10 insertions, 20 deletions
diff --git a/src/cowboy_handler.erl b/src/cowboy_handler.erl
index 7780e20..263c659 100644
--- a/src/cowboy_handler.erl
+++ b/src/cowboy_handler.erl
@@ -44,8 +44,7 @@
}).
-spec execute(Req, Env)
- -> {ok, Req, Env} | {error, 500, Req}
- | {suspend, ?MODULE, handler_loop, [any()]}
+ -> {ok, Req, Env} | {suspend, ?MODULE, handler_loop, [any()]}
when Req::cowboy_req:req(), Env::cowboy_middleware:env().
execute(Req, Env) ->
{_, Handler} = lists:keyfind(handler, 1, Env),
@@ -58,8 +57,7 @@ execute(Req, Env) ->
Handler, HandlerOpts).
-spec handler_init(Req, #state{}, module(), any())
- -> {ok, Req, cowboy_middleware:env()}
- | {error, 500, Req} | {suspend, module(), atom(), [any()]}
+ -> {ok, Req, cowboy_middleware:env()} | {suspend, module(), atom(), [any()]}
when Req::cowboy_req:req().
handler_init(Req, State, Handler, HandlerOpts) ->
Transport = cowboy_req:get(transport, Req),
@@ -108,9 +106,7 @@ upgrade_protocol(Req, #state{env=Env},
Module:upgrade(Req, Env, Handler, HandlerOpts).
-spec handler_handle(Req, #state{}, module(), any())
- -> {ok, Req, cowboy_middleware:env()}
- | {error, 500, Req}
- when Req::cowboy_req:req().
+ -> {ok, Req, cowboy_middleware:env()} when Req::cowboy_req:req().
handler_handle(Req, State, Handler, HandlerState) ->
try Handler:handle(Req, HandlerState) of
{ok, Req2, HandlerState2} ->
@@ -130,8 +126,7 @@ handler_handle(Req, State, Handler, HandlerState) ->
%% Update the state if the response was sent in the callback.
-spec handler_after_callback(Req, #state{}, module(), any())
- -> {ok, Req, cowboy_middleware:env()}
- | {error, 500, Req} | {suspend, module(), atom(), [any()]}
+ -> {ok, Req, cowboy_middleware:env()} | {suspend, module(), atom(), [any()]}
when Req::cowboy_req:req().
handler_after_callback(Req, State=#state{resp_sent=false}, Handler,
HandlerState) ->
@@ -146,8 +141,7 @@ handler_after_callback(Req, State, Handler, HandlerState) ->
handler_before_loop(Req, State, Handler, HandlerState).
-spec handler_before_loop(Req, #state{}, module(), any())
- -> {ok, Req, cowboy_middleware:env()}
- | {error, 500, Req} | {suspend, module(), atom(), [any()]}
+ -> {ok, Req, cowboy_middleware:env()} | {suspend, module(), atom(), [any()]}
when Req::cowboy_req:req().
handler_before_loop(Req, State=#state{hibernate=true}, Handler, HandlerState) ->
[Socket, Transport] = cowboy_req:get([socket, transport], Req),
@@ -173,8 +167,7 @@ handler_loop_timeout(State=#state{loop_timeout=Timeout,
State#state{loop_timeout_ref=TRef}.
-spec handler_loop(Req, #state{}, module(), any())
- -> {ok, Req, cowboy_middleware:env()}
- | {error, 500, Req} | {suspend, module(), atom(), [any()]}
+ -> {ok, Req, cowboy_middleware:env()} | {suspend, module(), atom(), [any()]}
when Req::cowboy_req:req().
handler_loop(Req, State=#state{loop_buffer_size=NbBytes,
loop_max_buffer=Threshold, loop_timeout_ref=TRef},
@@ -222,8 +215,7 @@ handler_loop(Req, State=#state{loop_buffer_size=NbBytes,
end.
-spec handler_call(Req, #state{}, module(), any(), any())
- -> {ok, Req, cowboy_middleware:env()}
- | {error, 500, Req} | {suspend, module(), atom(), [any()]}
+ -> {ok, Req, cowboy_middleware:env()} | {suspend, module(), atom(), [any()]}
when Req::cowboy_req:req().
handler_call(Req, State=#state{resp_sent=RespSent},
Handler, HandlerState, Message) ->
diff --git a/src/cowboy_rest.erl b/src/cowboy_rest.erl
index 5741dfe..f76468a 100644
--- a/src/cowboy_rest.erl
+++ b/src/cowboy_rest.erl
@@ -56,8 +56,7 @@
}).
-spec upgrade(Req, Env, module(), any())
- -> {ok, Req, Env} | {error, 500, Req}
- when Req::cowboy_req:req(), Env::cowboy_middleware:env().
+ -> {ok, Req, Env} when Req::cowboy_req:req(), Env::cowboy_middleware:env().
upgrade(Req, Env, Handler, HandlerOpts) ->
Method = cowboy_req:get(method, Req),
case erlang:function_exported(Handler, rest_init, 2) of
diff --git a/src/cowboy_websocket.erl b/src/cowboy_websocket.erl
index 98e25e6..6c41137 100644
--- a/src/cowboy_websocket.erl
+++ b/src/cowboy_websocket.erl
@@ -58,7 +58,7 @@
}).
-spec upgrade(Req, Env, module(), any())
- -> {ok, Req, Env} | {error, 400, Req}
+ -> {ok, Req, Env}
| {suspend, module(), atom(), [any()]}
when Req::cowboy_req:req(), Env::cowboy_middleware:env().
upgrade(Req, Env, Handler, HandlerOpts) ->
@@ -124,8 +124,7 @@ websocket_extensions(State, Req) ->
end.
-spec handler_init(#state{}, Req, any())
- -> {ok, Req, cowboy_middleware:env()} | {error, 400, Req}
- | {suspend, module(), atom(), [any()]}
+ -> {ok, Req, cowboy_middleware:env()} | {suspend, module(), atom(), [any()]}
when Req::cowboy_req:req().
handler_init(State=#state{env=Env, transport=Transport,
handler=Handler}, Req, HandlerOpts) ->