diff options
author | Adam Kocoloski <adam@cloudant.com> | 2010-06-16 16:46:35 -0400 |
---|---|---|
committer | Adam Kocoloski <adam@cloudant.com> | 2010-08-12 11:18:46 -0400 |
commit | 17e63f456d7c62178a6536ad2004f6d5c632ef53 (patch) | |
tree | 44c433a51d2dd7d60b809c770658ea597d20b4a4 /src | |
parent | b83ece9a18cacddbd98cdf1038a2b40ca9378f16 (diff) |
nicer error message when querying a non-existent DB
Diffstat (limited to 'src')
-rw-r--r-- | src/chttpd.erl | 6 |
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}) -> |