couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From beno...@apache.org
Subject [09/10] couch-httpd commit: updated refs/heads/1994-merge-rcouch to 82e454a
Date Sun, 13 Jul 2014 12:34:24 GMT
expose couch_httpd:send_error


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-httpd/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-httpd/commit/82e454a9
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-httpd/tree/82e454a9
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-httpd/diff/82e454a9

Branch: refs/heads/1994-merge-rcouch
Commit: 82e454a9d8021d85b7340895125c0bd3baaa47ec
Parents: f26c668
Author: benoitc <bchesneau@gmail.com>
Authored: Tue Jul 8 14:27:42 2014 +0200
Committer: benoitc <bchesneau@gmail.com>
Committed: Sun Jul 13 14:33:20 2014 +0200

----------------------------------------------------------------------
 src/couch_httpd.erl | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-httpd/blob/82e454a9/src/couch_httpd.erl
----------------------------------------------------------------------
diff --git a/src/couch_httpd.erl b/src/couch_httpd.erl
index 29f9db0..5d9552c 100644
--- a/src/couch_httpd.erl
+++ b/src/couch_httpd.erl
@@ -26,7 +26,8 @@
 -export([start_chunked_response/3,send_chunk/2,log_request/2]).
 -export([start_response_length/4, start_response/3, send/2]).
 -export([start_json_response/2, start_json_response/3, end_json_response/1]).
--export([send_response/4,send_method_not_allowed/2,send_error/4, send_redirect/2,send_chunked_error/2]).
+-export([send_response/4,send_method_not_allowed/2,send_error/2,
+        send_error/4,send_error/5, send_error/6, send_redirect/2,send_chunked_error/2]).
 -export([send_json/2,send_json/3,send_json/4,last_chunk/1,parse_multipart_request/3]).
 -export([accepted_encodings/1,handle_request_int/5,validate_referer/1,validate_ctype/2]).
 -export([http_1_0_keep_alive/2]).
@@ -887,6 +888,16 @@ send_error(Req, Code, Headers, ErrorStr, ReasonStr) ->
         {[{<<"error">>,  ErrorStr},
          {<<"reason">>, ReasonStr}]}).
 
+
+send_error(Req, Code, Headers, ErrorStr, ReasonStr, Stack) ->
+    send_json(Req, Code, Headers,
+        {[{<<"error">>, ErrorStr},
+        {<<"reason">>, ReasonStr} |
+        case Stack of [] -> []; _ -> [{stack, Stack}] end
+    ]}).
+
+
+
 % give the option for list functions to output html or other raw errors
 send_chunked_error(Resp, {_Error, {[{<<"body">>, Reason}]}}) ->
     send_chunk(Resp, Reason),


Mime
View raw message