diff options
author | Peng Hui Jiang <jiangphcn@apache.org> | 2018-11-15 13:31:13 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-15 13:31:13 +0800 |
commit | 269224b8d3ddddc2199643a0500076f4250c7d75 (patch) | |
tree | 75931e4eaae48965ca700441f28bff66a80a145f | |
parent | ff271a95b1611e55d1b071d40fa8d4b4c4caefbd (diff) | |
parent | 22e8fc1fab558cd63cd3404bee69120d6d5067cd (diff) | |
download | couchdb-269224b8d3ddddc2199643a0500076f4250c7d75.tar.gz |
Merge pull request #1717 from cloudant/COUCHDB-1380-fix-nasty-error
Fix nasty 500 error on POST to /_config
-rw-r--r-- | rebar.config.script | 2 | ||||
-rw-r--r-- | src/chttpd/src/chttpd_misc.erl | 8 |
2 files changed, 7 insertions, 3 deletions
diff --git a/rebar.config.script b/rebar.config.script index 65c3a8a04..c3c05dde3 100644 --- a/rebar.config.script +++ b/rebar.config.script @@ -48,7 +48,7 @@ SubDirs = [ DepDescs = [ %% Independent Apps -{config, "config", {tag, "2.1.3"}}, +{config, "config", {tag, "2.1.4"}}, {b64url, "b64url", {tag, "1.0.1"}}, {ets_lru, "ets-lru", {tag, "1.0.0"}}, {khash, "khash", {tag, "1.0.1"}}, diff --git a/src/chttpd/src/chttpd_misc.erl b/src/chttpd/src/chttpd_misc.erl index fc03fb512..efa7ef338 100644 --- a/src/chttpd/src/chttpd_misc.erl +++ b/src/chttpd/src/chttpd_misc.erl @@ -323,8 +323,12 @@ handle_node_req(#httpd{method='DELETE',path_parts=[_, Node, <<"_config">>, Secti undefined -> throw({not_found, unknown_config_value}); OldValue -> - call_node(Node, config, delete, [Section, Key, Persist]), - send_json(Req, 200, list_to_binary(OldValue)) + case call_node(Node, config, delete, [Section, Key, Persist]) of + ok -> + send_json(Req, 200, list_to_binary(OldValue)); + {error, Reason} -> + chttpd:send_error(Req, {bad_request, Reason}) + end end; handle_node_req(#httpd{path_parts=[_, _Node, <<"_config">>, _Section, _Key]}=Req) -> send_method_not_allowed(Req, "GET,PUT,DELETE"); |