summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwenwl <wenwl@cn.ibm.com>2018-11-07 16:46:57 +0800
committerwenwl <wenwl@cn.ibm.com>2018-11-15 13:01:00 +0800
commit22e8fc1fab558cd63cd3404bee69120d6d5067cd (patch)
tree75931e4eaae48965ca700441f28bff66a80a145f
parentff271a95b1611e55d1b071d40fa8d4b4c4caefbd (diff)
downloadcouchdb-22e8fc1fab558cd63cd3404bee69120d6d5067cd.tar.gz
Fix nasty 500 error on POST to /_config
-rw-r--r--rebar.config.script2
-rw-r--r--src/chttpd/src/chttpd_misc.erl8
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");