couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kxe...@apache.org
Subject [07/11] chttpd commit: updated refs/heads/setup to 2398380
Date Wed, 28 Jan 2015 15:18:16 GMT
Restore <<"unknown_error">> for HTTP 500 errors

This reverts changes made in 059229777 commit allowing chttpd to send
HTTP 500 errors in the same format as httpd does, e.g.:

  {"error": "unknown_error", "reason": "function_clause", "ref": 100500}

COUCHDB-2538


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

Branch: refs/heads/setup
Commit: ec31e09e540dc4916c416247d2eb8d132b51fffd
Parents: 6a2ed1d
Author: Alexander Shorin <kxepal@apache.org>
Authored: Fri Jan 9 18:32:28 2015 +0300
Committer: Alexander Shorin <kxepal@apache.org>
Committed: Wed Jan 21 04:36:54 2015 +0300

----------------------------------------------------------------------
 src/chttpd.erl                   | 8 ++++----
 test/chttpd_error_info_tests.erl | 6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/ec31e09e/src/chttpd.erl
----------------------------------------------------------------------
diff --git a/src/chttpd.erl b/src/chttpd.erl
index 8945d0a..682fb6f 100644
--- a/src/chttpd.erl
+++ b/src/chttpd.erl
@@ -750,19 +750,19 @@ error_info(request_entity_too_large) ->
     {413, <<"too_large">>, <<"the request entity is too large">>};
 error_info(not_implemented) ->
     {501, <<"not_implemented">>, <<"this feature is not yet implemented">>};
-error_info({Error, null}) ->
-    {500, couch_util:to_binary(Error), null};
 error_info(timeout) ->
     {500, <<"timeout">>, <<"The request could not be processed in a reasonable"
         " amount of time.">>};
+error_info({Error, null}) ->
+    error_info(Error);
 error_info({Error, Reason}) ->
     {500, couch_util:to_binary(Error), couch_util:to_binary(Reason)};
 error_info({Error, nil, _Stack}) ->
     error_info(Error);
 error_info({Error, Reason, _Stack}) ->
-    error_info({Error, Reason});
+    {500, couch_util:to_binary(Error), couch_util:to_binary(Reason)};
 error_info(Error) ->
-    {500, couch_util:to_binary(Error), null}.
+    {500, <<"unknown_error">>, couch_util:to_binary(Error)}.
 
 error_headers(#httpd{mochi_req=MochiReq}=Req, 401=Code, ErrorStr, ReasonStr) ->
     % this is where the basic auth popup is triggered

http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/ec31e09e/test/chttpd_error_info_tests.erl
----------------------------------------------------------------------
diff --git a/test/chttpd_error_info_tests.erl b/test/chttpd_error_info_tests.erl
index 225f540..a78bf80 100644
--- a/test/chttpd_error_info_tests.erl
+++ b/test/chttpd_error_info_tests.erl
@@ -137,7 +137,7 @@ error_info_test() ->
         },
         {
             {Error, null},
-            {500, Error, null}
+            {500, <<"unknown_error">>, Error}
         },
         {
             {Error, Reason},
@@ -145,7 +145,7 @@ error_info_test() ->
         },
         {
             {Error, nil, [{}]},
-            {500, Error, null}
+            {500, <<"unknown_error">>, Error}
         },
         {
             {Error, Reason, [{}]},
@@ -153,7 +153,7 @@ error_info_test() ->
         },
         {
             Error,
-            {500, Error, null}
+            {500, <<"unknown_error">>, Error}
         }
     ],
 


Mime
View raw message