From a8d6024454601d1a579e50f10631c5d13b22ef34 Mon Sep 17 00:00:00 2001 From: Filipe David Borba Manana Date: Mon, 13 Sep 2010 10:57:44 +0000 Subject: Replicator changes: 1) avoid badmatch exceptions when there's a failure opening a single document from a remote source; 2) add error log messages describing which remote documents couldn't be opened and why; 3) when replications errors can't be encoded as json, convert and send them as json strings git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@996492 13f79535-47bb-0310-9956-ffa450edef68 --- src/couchdb/couch_httpd_misc_handlers.erl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/couchdb/couch_httpd_misc_handlers.erl') diff --git a/src/couchdb/couch_httpd_misc_handlers.erl b/src/couchdb/couch_httpd_misc_handlers.erl index 46aba9eb..70db79f6 100644 --- a/src/couchdb/couch_httpd_misc_handlers.erl +++ b/src/couchdb/couch_httpd_misc_handlers.erl @@ -93,7 +93,12 @@ handle_replicate_req(#httpd{method='POST'}=Req) -> {error, not_found} -> send_json(Req, 404, {[{error, not_found}]}); {error, Reason} -> - send_json(Req, 500, {[{error, Reason}]}) + try + send_json(Req, 500, {[{error, Reason}]}) + catch + exit:{json_encode, _} -> + send_json(Req, 500, {[{error, couch_util:to_binary(Reason)}]}) + end catch throw:{db_not_found, Msg} -> send_json(Req, 404, {[{error, db_not_found}, {reason, Msg}]}) -- cgit v1.2.3