aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanielle Sucher <[email protected]>2013-10-03 23:44:53 -0400
committerLoïc Hoguin <[email protected]>2013-11-08 22:56:09 +0100
commit37e98f019ddf789c8523035f59ee4c43858db583 (patch)
treec48267874902731eadf3599906eb481b7e206ca3
parentfaf64524c6758ae1e27404d2ae1383a23538c538 (diff)
downloadcowboy-37e98f019ddf789c8523035f59ee4c43858db583.tar.gz
cowboy-37e98f019ddf789c8523035f59ee4c43858db583.tar.bz2
cowboy-37e98f019ddf789c8523035f59ee4c43858db583.zip
Clarify error msg for route lacking starting slash
-rw-r--r--src/cowboy_router.erl5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/cowboy_router.erl b/src/cowboy_router.erl
index e52b70b..16af2d4 100644
--- a/src/cowboy_router.erl
+++ b/src/cowboy_router.erl
@@ -92,7 +92,10 @@ compile_paths([{<< $/, PathMatch/binary >>, Constraints, Handler, Opts}|Tail],
Acc) ->
PathRules = compile_rules(PathMatch, $/, [], [], <<>>),
Paths = [{lists:reverse(R), Constraints, Handler, Opts} || R <- PathRules],
- compile_paths(Tail, Paths ++ Acc).
+ compile_paths(Tail, Paths ++ Acc);
+compile_paths([{PathMatch, _, _, _}|_], _) ->
+ error({badarg, "The following route MUST begin with a slash: "
+ ++ binary_to_list(PathMatch)}).
compile_rules(<<>>, _, Segments, Rules, <<>>) ->
[Segments|Rules];