summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzul <azul@riseup.net>2013-11-28 12:11:28 +0100
committerAzul <azul@riseup.net>2013-11-28 12:11:28 +0100
commitc5fea1a1bfaa6690d4d6728feda566e48af452e9 (patch)
treecab4ef7775e7c3e61e22be87d5802ca425dc7b61
parenta5b66b15b7f68a1da31dd3ff0466c3be16f031c0 (diff)
rescue from 404 when destroying db
Also logging per user db creation and destruction if they happen.
-rw-r--r--lib/tapicero/user_database.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/tapicero/user_database.rb b/lib/tapicero/user_database.rb
index ec2694a..8f461ef 100644
--- a/lib/tapicero/user_database.rb
+++ b/lib/tapicero/user_database.rb
@@ -10,10 +10,9 @@ module Tapicero
end
def create
- begin
- CouchRest.new(host).create_db(name)
- rescue RestClient::PreconditionFailed # database already existed
- end
+ CouchRest.new(host).create_db(name)
+ Tapicero.logger.debug "database created successfully."
+ rescue RestClient::PreconditionFailed # database already existed
end
def secure(security)
@@ -27,6 +26,8 @@ module Tapicero
def destroy
db = CouchRest.new(host).database(name)
db.delete! if db
+ Tapicero.logger.debug "database deleted successfully."
+ rescue RestClient::ResourceNotFound # no database found
end
protected