Move db exception to the right module

This commit is contained in:
vrde 2016-02-12 15:01:56 +01:00
parent 41043b7e6f
commit a0761612ec
2 changed files with 5 additions and 6 deletions

View File

@ -1,17 +1,13 @@
"""Utils to initialize and drop the database."""
import logging
import rethinkdb as r
import bigchaindb
from bigchaindb import exceptions
logger = logging.getLogger(__name__)
class DatabaseAlreadyExistsException(Exception):
pass
def get_conn():
'''Get the connection to the database.'''
@ -24,7 +20,7 @@ def init():
dbname = bigchaindb.config['database']['name']
if r.db_list().contains(dbname).run(conn):
raise DatabaseAlreadyExistsException('Database `{}` already exists'.format(dbname))
raise exceptions.DatabaseAlreadyExistsException('Database `{}` already exists'.format(dbname))
logger.info('Create:')
logger.info(' - database `%s`', dbname)

View File

@ -19,3 +19,6 @@ class InvalidHash(Exception):
class InvalidSignature(Exception):
"""Raised if there was an error checking the signature for a particular operation"""
class DatabaseAlreadyExistsException(Exception):
"""Raised when trying to create the database but the db is already there"""