mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Merge pull request #22 from bigchaindb/move-db-exception-to-the-right-module
Move db exception to the right module
This commit is contained in:
commit
34e1507575
@ -5,13 +5,11 @@ 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 +22,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.DatabaseAlreadyExists('Database `{}` already exists'.format(dbname))
|
||||
|
||||
logger.info('Create:')
|
||||
logger.info(' - database `%s`', dbname)
|
||||
|
@ -19,3 +19,6 @@ class InvalidHash(Exception):
|
||||
class InvalidSignature(Exception):
|
||||
"""Raised if there was an error checking the signature for a particular operation"""
|
||||
|
||||
class DatabaseAlreadyExists(Exception):
|
||||
"""Raised when trying to create the database but the db is already there"""
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user