couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fdman...@apache.org
Subject svn commit: r992883 - in /couchdb/branches/new_replicator/src/couchdb: couch_api_wrap.erl couch_replicate.erl
Date Sun, 05 Sep 2010 19:50:51 GMT
Author: fdmanana
Date: Sun Sep  5 19:50:51 2010
New Revision: 992883

URL: http://svn.apache.org/viewvc?rev=992883&view=rev
Log:
New replicator: better error handling when updating a document.

Modified:
    couchdb/branches/new_replicator/src/couchdb/couch_api_wrap.erl
    couchdb/branches/new_replicator/src/couchdb/couch_replicate.erl

Modified: couchdb/branches/new_replicator/src/couchdb/couch_api_wrap.erl
URL: http://svn.apache.org/viewvc/couchdb/branches/new_replicator/src/couchdb/couch_api_wrap.erl?rev=992883&r1=992882&r2=992883&view=diff
==============================================================================
--- couchdb/branches/new_replicator/src/couchdb/couch_api_wrap.erl (original)
+++ couchdb/branches/new_replicator/src/couchdb/couch_api_wrap.erl Sun Sep  5 19:50:51 2010
@@ -301,15 +301,15 @@ update_doc(#httpdb{} = HttpDb, #doc{id =
             {qs, QArgs}, {headers, Headers}, {body, {SendFun, Len}}],
         fun(Code, _, {Props}) when Code =:= 200 orelse Code =:= 201 ->
                 {ok, couch_doc:parse_rev(get_value(<<"rev">>, Props))};
-            (401, _, _) ->
-                {error, unauthorized}
+            (_, _, {Props}) ->
+                {error, get_value(<<"error">>, Props)}
         end);
 update_doc(Db, Doc, Options, Type) ->
     try
         couch_db:update_doc(Db, Doc, Options, Type)
     catch
     throw:{unauthorized, _} ->
-        {error, unauthorized}
+        {error, <<"unauthorized">>}
     end.
 
 changes_since(#httpdb{} = HttpDb, Style, StartSeq, UserFun, Options) ->

Modified: couchdb/branches/new_replicator/src/couchdb/couch_replicate.erl
URL: http://svn.apache.org/viewvc/couchdb/branches/new_replicator/src/couchdb/couch_replicate.erl?rev=992883&r1=992882&r2=992883&view=diff
==============================================================================
--- couchdb/branches/new_replicator/src/couchdb/couch_replicate.erl (original)
+++ couchdb/branches/new_replicator/src/couchdb/couch_replicate.erl Sun Sep  5 19:50:51 2010
@@ -633,7 +633,7 @@ doc_handler({ok, Doc}, Target, Cp) ->
     Error ->
         Cp ! {add_stat, {#stats.doc_write_failures, 1}},
         case Error of
-        {error, unauthorized} ->
+        {error, <<"unauthorized">>} ->
             ?LOG_ERROR("Replicator: unauthorized to write document ~s to ~s",
                 [?b2l(Doc#doc.id), couch_api_wrap:db_uri(Target)]);
         _ ->



Mime
View raw message