Skip to content

Instantly share code, notes, and snippets.

@rnewson
Created January 30, 2014 21:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rnewson/8720700 to your computer and use it in GitHub Desktop.
Save rnewson/8720700 to your computer and use it in GitHub Desktop.
commit 3659c01c686f61ae222735dd9e08b932163438e1
Author: Robert Newson <rnewson@apache.org>
Date: 2014-01-30 21:46:36 +0000
Produce a readable error if status code for open_revs is not 200
CouchDB-2043
diff --git a/src/couch_replicator/src/couch_replicator_api_wrap.erl b/src/couch_replicator/src/couch_replicator_api_wrap.erl
index 52e15b7..344074e 100644
--- a/src/couch_replicator/src/couch_replicator_api_wrap.erl
+++ b/src/couch_replicator/src/couch_replicator_api_wrap.erl
@@ -171,13 +171,15 @@ open_doc_revs(#httpdb{} = HttpDb, Id, Revs, Options, Fun, Acc) ->
QS = options_to_query_args(HttpDb, Path, [revs, {open_revs, Revs} | Options]),
{Pid, Ref} = spawn_monitor(fun() ->
Self = self(),
- Callback = fun(200, Headers, StreamDataFun) ->
- remote_open_doc_revs_streamer_start(Self),
- {<<"--">>, _, _} = couch_httpd:parse_multipart_request(
- get_value("Content-Type", Headers),
- StreamDataFun,
- fun mp_parse_mixed/1
- )
+ Callback = fun
+ (200, Headers, StreamDataFun) ->
+ remote_open_doc_revs_streamer_start(Self),
+ {<<"--">>, _, _} = couch_httpd:parse_multipart_request(
+ get_value("Content-Type", Headers),
+ StreamDataFun,
+ fun mp_parse_mixed/1);
+ (Code, _, _) ->
+ exit({unexpected_status_code, Code})
end,
Streamer = spawn_link(fun() ->
Params = [
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment