summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Kocoloski <adam@cloudant.com>2010-06-16 16:46:35 -0400
committerAdam Kocoloski <adam@cloudant.com>2010-08-12 11:18:46 -0400
commit17e63f456d7c62178a6536ad2004f6d5c632ef53 (patch)
tree44c433a51d2dd7d60b809c770658ea597d20b4a4
parentb83ece9a18cacddbd98cdf1038a2b40ca9378f16 (diff)
nicer error message when querying a non-existent DB
-rw-r--r--src/chttpd.erl6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/chttpd.erl b/src/chttpd.erl
index ee55f3e8..d178604d 100644
--- a/src/chttpd.erl
+++ b/src/chttpd.erl
@@ -118,9 +118,9 @@ handle_request(MochiReq) ->
showroom_log:message(notice, LogForClosedSocket, []),
exit(normal);
throw:Error ->
- % ?LOG_DEBUG("Minor error in HTTP request: ~p",[Error]),
- % ?LOG_DEBUG("Stacktrace: ~p",[erlang:get_stacktrace()]),
send_error(HttpReq, Error);
+ error:database_does_not_exist ->
+ send_error(HttpReq, database_does_not_exist);
error:badarg ->
?LOG_ERROR("Badarg error in HTTP request",[]),
?LOG_INFO("Stacktrace: ~p",[erlang:get_stacktrace()]),
@@ -494,6 +494,8 @@ error_info({bad_request, Reason}) ->
{400, <<"bad_request">>, Reason};
error_info({query_parse_error, Reason}) ->
{400, <<"query_parse_error">>, Reason};
+error_info(database_does_not_exist) ->
+ {404, <<"not_found">>, <<"database_does_not_exist">>};
error_info(not_found) ->
{404, <<"not_found">>, <<"missing">>};
error_info({not_found, Reason}) ->