summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDamien F. Katz <damien@apache.org>2008-08-07 20:28:42 +0000
committerDamien F. Katz <damien@apache.org>2008-08-07 20:28:42 +0000
commit986302c54df1bdb4be3dc1d1a4d5a9f34e6af50d (patch)
tree6f9d1caef3dc1b619999890a0e364961c88f2992 /src
parentd721ef270cf548e2d217c471da44d0c31054ed98 (diff)
Fix for bug COUCHDB-100.
git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@683704 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/couchdb/couch_db.erl2
-rw-r--r--src/couchdb/couch_httpd.erl16
2 files changed, 11 insertions, 7 deletions
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]});