From 165531bcf223f1c05c4c2eaef7cd2f2943c10584 Mon Sep 17 00:00:00 2001 From: Adam Kocoloski Date: Sat, 15 Aug 2009 05:11:45 +0000 Subject: better failure modes in replication. See COUCHDB-193, COUCHDB-416 If you try to replicate a DB to itself, the replication will proceed, but no checkpoints will be saved, and the logs will say "checkpoint failure: conflict (are you replicating to yourself?)" If you try to specify a non-existent DB as source or target, replication will fail immediately with a 404. The response body will indicate which DB could not be opened. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@804436 13f79535-47bb-0310-9956-ffa450edef68 --- src/couchdb/couch_rep_httpc.erl | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/couchdb/couch_rep_httpc.erl') diff --git a/src/couchdb/couch_rep_httpc.erl b/src/couchdb/couch_rep_httpc.erl index 3e3b5f05..3d0696e4 100644 --- a/src/couchdb/couch_rep_httpc.erl +++ b/src/couchdb/couch_rep_httpc.erl @@ -96,6 +96,8 @@ process_response({ok, Status, Headers, Body}, Req) -> MochiHeaders = mochiweb_headers:make(Headers), RedirectUrl = mochiweb_headers:get_value("Location", MochiHeaders), do_request(Req#http_db{url = RedirectUrl}); + Code =:= 409 -> + throw(conflict); Code >= 400, Code < 500 -> ?JSON_DECODE(maybe_decompress(Headers, Body)); Code =:= 500; Code =:= 502 -> -- cgit v1.2.3