From 24b9d0d572a9ed81366954d8bd76adf33819869c Mon Sep 17 00:00:00 2001 From: Robert Newson Date: Fri, 26 May 2017 10:52:00 +0100 Subject: Send a better error when opening a db without authorisation COUCHDB-3426 --- src/couch_replicator/src/couch_replicator_api_wrap.erl | 4 ++++ 1 file changed, 4 insertions(+) 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) -- cgit v1.2.1