couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fdman...@apache.org
Subject svn commit: r996127 - /couchdb/branches/new_replicator/src/couchdb/couch_api_wrap_httpc.erl
Date Sat, 11 Sep 2010 11:57:22 GMT
Author: fdmanana
Date: Sat Sep 11 11:57:21 2010
New Revision: 996127

URL: http://svn.apache.org/viewvc?rev=996127&view=rev
Log:
New replicator: added error handling for streamming response.

Modified:
    couchdb/branches/new_replicator/src/couchdb/couch_api_wrap_httpc.erl

Modified: couchdb/branches/new_replicator/src/couchdb/couch_api_wrap_httpc.erl
URL: http://svn.apache.org/viewvc/couchdb/branches/new_replicator/src/couchdb/couch_api_wrap_httpc.erl?rev=996127&r1=996126&r2=996127&view=diff
==============================================================================
--- couchdb/branches/new_replicator/src/couchdb/couch_api_wrap_httpc.erl (original)
+++ couchdb/branches/new_replicator/src/couchdb/couch_api_wrap_httpc.erl Sat Sep 11 11:57:21
2010
@@ -111,7 +111,7 @@ report_error(Worker, HttpDb, Params, Err
     Url = strip_creds(full_url(HttpDb, Params)),
     do_report_error(Url, Method, Error),
     stop_worker(Worker),
-    exit({http_request_failed, Method, Url}).
+    exit({http_request_failed, Method, Url, Error}).
 
 
 do_report_error(FullUrl, Method, {reason, Reason}) ->
@@ -129,7 +129,10 @@ do_report_error(Url, Method, {timeout, T
 
 stream_data_self(HttpDb, Params, Worker, ReqId) ->
     ibrowse:stream_next(ReqId),
-    receive {ibrowse_async_response, ReqId, Data} ->
+    receive
+    {ibrowse_async_response, ReqId, {error, Error}} ->
+        report_error(Worker, HttpDb, Params, {reason, Error});
+    {ibrowse_async_response, ReqId, Data} ->
         {Data, fun() -> stream_data_self(HttpDb, Params, Worker, ReqId) end};
     {ibrowse_async_response_end, ReqId} ->
         {<<>>, fun() -> stream_data_self(HttpDb, Params, Worker, ReqId) end}



Mime
View raw message