aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2014-09-24 15:07:59 +0300
committerLoïc Hoguin <[email protected]>2014-09-24 15:07:59 +0300
commitfd37fad592fc96a384bcd060696194f5fe074f6f (patch)
tree015cee3eda637d194bcc654d96d813d4648fc02f
parentc56bada509a448348ba724841a27abed201b4861 (diff)
downloadcowboy-fd37fad592fc96a384bcd060696194f5fe074f6f.tar.gz
cowboy-fd37fad592fc96a384bcd060696194f5fe074f6f.tar.bz2
cowboy-fd37fad592fc96a384bcd060696194f5fe074f6f.zip
Small tweak from erlang:error/1 to error/1
-rw-r--r--src/cowboy_router.erl10
-rw-r--r--test/http_SUITE_data/http_errors.erl10
2 files changed, 10 insertions, 10 deletions
diff --git a/src/cowboy_router.erl b/src/cowboy_router.erl
index 2e54151..b09051e 100644
--- a/src/cowboy_router.erl
+++ b/src/cowboy_router.erl
@@ -104,7 +104,7 @@ compile_rules(<< $:, Rest/binary >>, S, Segments, Rules, <<>>) ->
Name = binary_to_atom(NameBin, utf8),
compile_rules(Rest2, S, Segments, Rules, Name);
compile_rules(<< $:, _/binary >>, _, _, _, _) ->
- erlang:error(badarg);
+ error(badarg);
compile_rules(<< $[, $., $., $., $], Rest/binary >>, S, Segments, Rules, Acc)
when Acc =:= <<>> ->
compile_rules(Rest, S, ['...'|Segments], Rules, Acc);
@@ -116,17 +116,17 @@ compile_rules(<< $[, Rest/binary >>, S, Segments, Rules, <<>>) ->
compile_brackets(Rest, S, Segments, Rules);
%% Open bracket in the middle of a segment.
compile_rules(<< $[, _/binary >>, _, _, _, _) ->
- erlang:error(badarg);
+ error(badarg);
%% Missing an open bracket.
compile_rules(<< $], _/binary >>, _, _, _, _) ->
- erlang:error(badarg);
+ error(badarg);
compile_rules(<< C, Rest/binary >>, S, Segments, Rules, Acc) ->
compile_rules(Rest, S, Segments, Rules, << Acc/binary, C >>).
%% Everything past $: until the segment separator ($. for hosts,
%% $/ for paths) or $[ or $] or end of binary is the binding name.
compile_binding(<<>>, _, <<>>) ->
- erlang:error(badarg);
+ error(badarg);
compile_binding(Rest = <<>>, _, Acc) ->
{Acc, Rest};
compile_binding(Rest = << C, _/binary >>, S, Acc)
@@ -144,7 +144,7 @@ compile_brackets(Rest, S, Segments, Rules) ->
%% Missing a close bracket.
compile_brackets_split(<<>>, _, _) ->
- erlang:error(badarg);
+ error(badarg);
%% Make sure we don't confuse the closing bracket we're looking for.
compile_brackets_split(<< C, Rest/binary >>, Acc, N) when C =:= $[ ->
compile_brackets_split(Rest, << Acc/binary, C >>, N + 1);
diff --git a/test/http_SUITE_data/http_errors.erl b/test/http_SUITE_data/http_errors.erl
index 57fd684..7c3872b 100644
--- a/test/http_SUITE_data/http_errors.erl
+++ b/test/http_SUITE_data/http_errors.erl
@@ -10,11 +10,11 @@ init({_Transport, http}, Req, _Opts) ->
case_init(<<"init_before_reply">> = Case, _Req) ->
cowboy_error_h:ignore(?MODULE, case_init, 2),
- erlang:error(Case);
+ error(Case);
case_init(<<"init_after_reply">> = Case, Req) ->
cowboy_error_h:ignore(?MODULE, case_init, 2),
_ = cowboy_req:reply(200, [], "http_handler_crashes", Req),
- erlang:error(Case);
+ error(Case);
case_init(<<"init_reply_handle_error">> = Case, Req) ->
Req1 = cowboy_req:reply(200, [], "http_handler_crashes", Req),
{ok, Req1, Case};
@@ -25,14 +25,14 @@ case_init(<<"handle_after_reply">> = Case, Req) ->
handle(_Req, <<"init_reply_handle_error">> = Case) ->
cowboy_error_h:ignore(?MODULE, handle, 2),
- erlang:error(Case);
+ error(Case);
handle(_Req, <<"handle_before_reply">> = Case) ->
cowboy_error_h:ignore(?MODULE, handle, 2),
- erlang:error(Case);
+ error(Case);
handle(Req, <<"handle_after_reply">> = Case) ->
cowboy_error_h:ignore(?MODULE, handle, 2),
_ = cowboy_req:reply(200, [], "http_handler_crashes", Req),
- erlang:error(Case).
+ error(Case).
terminate(_, _, _) ->
ok.