Permalink
Browse files

icorrectly handle not_found error from validate_doc_read

  • Loading branch information...
1 parent 1d8dd4d commit 9f818237714a0d5c75fa41a6de4e2f6b939131f2 @benoitc benoitc committed Aug 18, 2013
Showing with 5 additions and 3 deletions.
  1. +2 −2 apps/couch/src/couch_db.erl
  2. +3 −1 apps/couch/src/couch_query_servers.erl
@@ -1391,8 +1391,8 @@ validate_doc_read(Db, Doc) ->
throw(Error);
throw:{unauthorized, _}=Error ->
throw(Error);
- throw:{notfound, Reason}=Error ->
- throw({not_found, Reason});
+ throw:{not_found, _}=Error ->
+ throw(Error);
throw:Error ->
lager:error("Error while validating read: ~p~n", [Error]),
ok
@@ -249,7 +249,9 @@ validate_doc_read(DDoc, Doc, Ctx, SecObj) ->
{[{<<"forbidden">>, Message}]} ->
throw({forbidden, Message});
{[{<<"unauthorized">>, Message}]} ->
- throw({unauthorized, Message})
+ throw({unauthorized, Message});
+ {[{<<"notfound">>, Message}]} ->
+ throw({not_found, Message})
end.

0 comments on commit 9f81823

Please sign in to comment.