Repository: couchdb-chttpd
Updated Branches:
refs/heads/master 9c126cd25 -> 1ca78bfd8
Convert {timeout, Error} errors to timeout
If chttpd got a {timeout, Error} error then it would return
that tuple to the client. Since Error is some internal specifics
this isn't particularly useful information to return to the client.
This commit converts it to our usual timeout response.
This closes #18
COUCHDB-2425
Signed-off-by: Alexander Shorin <[email protected]>
Project: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/commit/1ca78bfd
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/tree/1ca78bfd
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/diff/1ca78bfd
Branch: refs/heads/master
Commit: 1ca78bfd8058a79fed6c754dd5771ad80d554625
Parents: 9c126cd
Author: Mike Wallace <[email protected]>
Authored: Thu Jan 15 15:31:09 2015 +0000
Committer: Alexander Shorin <[email protected]>
Committed: Fri Jan 23 19:05:28 2015 +0300
----------------------------------------------------------------------
src/chttpd.erl | 2 ++
test/chttpd_error_info_tests.erl | 6 ++++++
2 files changed, 8 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/1ca78bfd/src/chttpd.erl
----------------------------------------------------------------------
diff --git a/src/chttpd.erl b/src/chttpd.erl
index 682fb6f..1b77da3 100644
--- a/src/chttpd.erl
+++ b/src/chttpd.erl
@@ -753,6 +753,8 @@ error_info(not_implemented) ->
error_info(timeout) ->
{500, <<"timeout">>, <<"The request could not be processed in a reasonable"
" amount of time.">>};
+error_info({timeout, _Reason}) ->
+ error_info(timeout);
error_info({Error, null}) ->
error_info(Error);
error_info({Error, Reason}) ->
http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/1ca78bfd/test/chttpd_error_info_tests.erl
----------------------------------------------------------------------
diff --git a/test/chttpd_error_info_tests.erl b/test/chttpd_error_info_tests.erl
index a78bf80..447eb42 100644
--- a/test/chttpd_error_info_tests.erl
+++ b/test/chttpd_error_info_tests.erl
@@ -136,6 +136,12 @@ error_info_test() ->
" amount of time.">>}
},
{
+ {timeout, Error},
+ {500, <<"timeout">>,
+ <<"The request could not be processed in a reasonable"
+ " amount of time.">>}
+ },
+ {
{Error, null},
{500, <<"unknown_error">>, Error}
},