summaryrefslogtreecommitdiff
path: root/src/couchdb/couch_doc.erl
diff options
context:
space:
mode:
authorJohn Christopher Anderson <jchris@apache.org>2009-03-15 00:15:40 +0000
committerJohn Christopher Anderson <jchris@apache.org>2009-03-15 00:15:40 +0000
commitdb6c33efaab3f16495e439fc01ccd5f55a0ece43 (patch)
treea9c2154d8a6cb08206b4666a20a52afbf478bfa0 /src/couchdb/couch_doc.erl
parent9007e2d21dea8b0185c0096b30364a8ee40a3867 (diff)
error message on invalid rev format.
another replication test. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@754563 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb/couch_doc.erl')
-rw-r--r--src/couchdb/couch_doc.erl9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/couchdb/couch_doc.erl b/src/couchdb/couch_doc.erl
index fc817d56..3c4fd98c 100644
--- a/src/couchdb/couch_doc.erl
+++ b/src/couchdb/couch_doc.erl
@@ -129,9 +129,12 @@ from_json_obj(_Other) ->
parse_rev(Rev) when is_binary(Rev) ->
parse_rev(?b2l(Rev));
parse_rev(Rev) ->
- {Pos, [$- | RevId]} = lists:splitwith(fun($-) -> false; (_) -> true end, Rev),
- {list_to_integer(Pos), ?l2b(RevId)}.
-
+ SplitRev = lists:splitwith(fun($-) -> false; (_) -> true end, Rev),
+ case SplitRev of
+ {Pos, [$- | RevId]} -> {list_to_integer(Pos), ?l2b(RevId)};
+ _Else -> throw({bad_request, <<"Invalid rev format">>})
+ end.
+
parse_revs([]) ->
[];
parse_revs([Rev | Rest]) ->