diff options
Diffstat (limited to 'src/couchdb')
-rw-r--r-- | src/couchdb/couch_db.erl | 2 | ||||
-rw-r--r-- | src/couchdb/couch_httpd.erl | 16 |
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]}); |