summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Newson <rnewson@apache.org>2017-05-26 10:52:00 +0100
committerRobert Newson <rnewson@apache.org>2017-05-26 11:02:57 +0100
commit24b9d0d572a9ed81366954d8bd76adf33819869c (patch)
tree2f018a8ebd6add0d9beb1fea2702456857978a36
parentb75fded3a81526e4d513514f0816deed73f151f7 (diff)
downloadcouchdb-3426-forbidden-error.tar.gz
Send a better error when opening a db without authorisation3426-forbidden-error
COUCHDB-3426
-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)