couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject [29/50] git commit: Allow custom Bad Request errors
Date Fri, 17 Jan 2014 21:37:23 GMT
Allow custom Bad Request errors

BugzID: 17352


Project: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/commit/20001d14
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/tree/20001d14
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/diff/20001d14

Branch: refs/heads/import
Commit: 20001d148d035d82fecf225e0b6ff3b42dc890ef
Parents: 4e4f4e1
Author: Adam Kocoloski <adam@cloudant.com>
Authored: Thu Feb 14 15:24:58 2013 -0500
Committer: Robert Newson <robert.newson@cloudant.com>
Committed: Wed Mar 6 12:22:37 2013 -0600

----------------------------------------------------------------------
 src/chttpd.erl | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/20001d14/src/chttpd.erl
----------------------------------------------------------------------
diff --git a/src/chttpd.erl b/src/chttpd.erl
index 660f7e5..6027020 100644
--- a/src/chttpd.erl
+++ b/src/chttpd.erl
@@ -667,6 +667,8 @@ error_info(bad_request) ->
     {400, <<"bad_request">>, <<>>};
 error_info({bad_request, Reason}) ->
     {400, <<"bad_request">>, Reason};
+error_info({bad_request, Error, Reason}) ->
+    {400, couch_util:to_binary(Error), couch_util:to_binary(Reason)};
 error_info({query_parse_error, Reason}) ->
     {400, <<"query_parse_error">>, Reason};
 error_info(database_does_not_exist) ->
@@ -821,6 +823,8 @@ server_header() ->
 reqid() ->
     {"X-Couch-Request-ID", get(nonce)}.
 
+json_stack({bad_request, _, _}) ->
+    [];
 json_stack({_Error, _Reason, Stack}) ->
     lists:map(fun json_stack_item/1, Stack);
 json_stack(_) ->


Mime
View raw message