aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_router.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2014-09-24 15:03:10 +0300
committerLoïc Hoguin <[email protected]>2014-09-24 15:03:10 +0300
commitc56bada509a448348ba724841a27abed201b4861 (patch)
tree10162f5c47ad8394f74f12e4105e20488e9c3fd1 /src/cowboy_router.erl
parentaa4d86b81f6095316813c599659014c15bf9b935 (diff)
downloadcowboy-c56bada509a448348ba724841a27abed201b4861.tar.gz
cowboy-c56bada509a448348ba724841a27abed201b4861.tar.bz2
cowboy-c56bada509a448348ba724841a27abed201b4861.zip
Remove the error tuple return value for middlewares
It wasn't interesting compared to simply returning a halt tuple with an explicit reply.
Diffstat (limited to 'src/cowboy_router.erl')
-rw-r--r--src/cowboy_router.erl8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/cowboy_router.erl b/src/cowboy_router.erl
index 3b71205..2e54151 100644
--- a/src/cowboy_router.erl
+++ b/src/cowboy_router.erl
@@ -157,7 +157,7 @@ compile_brackets_split(<< C, Rest/binary >>, Acc, N) ->
compile_brackets_split(Rest, << Acc/binary, C >>, N).
-spec execute(Req, Env)
- -> {ok, Req, Env} | {error, 400 | 404, Req}
+ -> {ok, Req, Env} | {halt, Req}
when Req::cowboy_req:req(), Env::cowboy_middleware:env().
execute(Req, Env) ->
{_, Dispatch} = lists:keyfind(dispatch, 1, Env),
@@ -168,11 +168,11 @@ execute(Req, Env) ->
Req2 = cowboy_req:set_bindings(HostInfo, PathInfo, Bindings, Req),
{ok, Req2, [{handler, Handler}, {handler_opts, HandlerOpts}|Env]};
{error, notfound, host} ->
- {error, 400, Req};
+ {halt, cowboy_req:reply(400, Req)};
{error, badrequest, path} ->
- {error, 400, Req};
+ {halt, cowboy_req:reply(400, Req)};
{error, notfound, path} ->
- {error, 404, Req}
+ {halt, cowboy_req:reply(404, Req)}
end.
%% Internal.