summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Newson <rnewson@apache.org>2017-05-26 15:29:40 +0100
committerGitHub <noreply@github.com>2017-05-26 15:29:40 +0100
commitbfad30ad01daa72074fd80d734950d63c8838364 (patch)
treeab4722fd2c569e1b3744e69fbf3d60845bc906e1
parent048e6e6f82f78c16abe3f7da66f7d29b3f8bc447 (diff)
parent24b9d0d572a9ed81366954d8bd76adf33819869c (diff)
downloadcouchdb-bfad30ad01daa72074fd80d734950d63c8838364.tar.gz
Merge pull request #542 from apache/3426-forbidden-error
Send a better error when opening a db without authorisation
-rw-r--r--src/couch_replicator/src/couch_replicator_api_wrap.erl4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/couch_replicator/src/couch_replicator_api_wrap.erl b/src/couch_replicator/src/couch_replicator_api_wrap.erl
index a0d08d777..91d7d7ae5 100644
--- a/src/couch_replicator/src/couch_replicator_api_wrap.erl
+++ b/src/couch_replicator/src/couch_replicator_api_wrap.erl
@@ -80,6 +80,8 @@ db_open(#httpdb{} = Db1, _Options, Create) ->
send_req(Db, [{method, put}],
fun(401, _, _) ->
throw({unauthorized, ?l2b(db_uri(Db))});
+ (403, _, _) ->
+ throw({forbidden, ?l2b(db_uri(Db))});
(_, _, _) ->
ok
end)
@@ -100,6 +102,8 @@ db_open(#httpdb{} = Db1, _Options, Create) ->
throw({db_not_found, ?l2b(db_uri(Db))});
(401, _, _) ->
throw({unauthorized, ?l2b(db_uri(Db))});
+ (403, _, _) ->
+ throw({forbidden, ?l2b(db_uri(Db))});
(_, _, _) ->
throw({db_not_found, ?l2b(db_uri(Db))})
end)