From 986302c54df1bdb4be3dc1d1a4d5a9f34e6af50d Mon Sep 17 00:00:00 2001 From: "Damien F. Katz" Date: Thu, 7 Aug 2008 20:28:42 +0000 Subject: Fix for bug COUCHDB-100. git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@683704 13f79535-47bb-0310-9956-ffa450edef68 --- src/couchdb/couch_db.erl | 2 +- src/couchdb/couch_httpd.erl | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/couchdb/couch_db.erl b/src/couchdb/couch_db.erl index 098f3de7..e8c7eb93 100644 --- a/src/couchdb/couch_db.erl +++ b/src/couchdb/couch_db.erl @@ -44,7 +44,7 @@ start_link0(DbName, Filepath, Options) -> ok = file:rename(Filepath ++ ".compact", Filepath), Fd0; {error, enoent} -> - throw({error, not_found}) + throw(not_found) end; Else -> throw(Else) diff --git a/src/couchdb/couch_httpd.erl b/src/couchdb/couch_httpd.erl index 86e41f8b..85fbe868 100644 --- a/src/couchdb/couch_httpd.erl +++ b/src/couchdb/couch_httpd.erl @@ -168,6 +168,16 @@ handle_db_request(Req, 'PUT', {DbName, []}) -> throw({unknown_error, Msg}) end; +handle_db_request(Req, 'DELETE', {DbName, []}) -> + case couch_server:delete(DbName) of + ok -> + send_json(Req, 200, {obj, [ + {ok, true} + ]}); + Error -> + throw(Error) + end; + handle_db_request(Req, Method, {DbName, Rest}) -> case couch_db:open(DbName, []) of {ok, Db} -> @@ -180,12 +190,6 @@ handle_db_request(Req, Method, {DbName, Rest}) -> throw(Error) end; -handle_db_request(Req, 'DELETE', {DbName, _Db, []}) -> - ok = couch_server:delete(DbName), - send_json(Req, 200, {obj, [ - {ok, true} - ]}); - handle_db_request(Req, 'GET', {DbName, Db, []}) -> {ok, DbInfo} = couch_db:get_db_info(Db), send_json(Req, {obj, [{db_name, DbName} | DbInfo]}); -- cgit v1.2.3