diff options
author | Filipe David Borba Manana <fdmanana@apache.org> | 2010-09-13 10:57:44 +0000 |
---|---|---|
committer | Filipe David Borba Manana <fdmanana@apache.org> | 2010-09-13 10:57:44 +0000 |
commit | a8d6024454601d1a579e50f10631c5d13b22ef34 (patch) | |
tree | a924518987d8983798ba4e1e5c763c0d327a2daf /src/couchdb/couch_httpd_misc_handlers.erl | |
parent | d70f2b570b1402226cb6bf1bf7e53e1e71564679 (diff) |
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
Diffstat (limited to 'src/couchdb/couch_httpd_misc_handlers.erl')
-rw-r--r-- | src/couchdb/couch_httpd_misc_handlers.erl | 7 |
1 files changed, 6 insertions, 1 deletions
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}]}) |