diff --git a/bigchaindb/common/exceptions.py b/bigchaindb/common/exceptions.py index c4ccd083..60340492 100644 --- a/bigchaindb/common/exceptions.py +++ b/bigchaindb/common/exceptions.py @@ -1,28 +1,29 @@ """Custom exceptions used in the `bigchaindb` package. """ +from bigchaindb.exceptions import BigchainDBError -class ConfigurationError(Exception): +class ConfigurationError(BigchainDBError): """Raised when there is a problem with server configuration""" -class OperationError(Exception): +class OperationError(BigchainDBError): """Raised when an operation cannot go through""" -class TransactionDoesNotExist(Exception): +class TransactionDoesNotExist(BigchainDBError): """Raised if the transaction is not in the database""" -class TransactionOwnerError(Exception): +class TransactionOwnerError(BigchainDBError): """Raised if a user tries to transfer a transaction they don't own""" -class DoubleSpend(Exception): +class DoubleSpend(BigchainDBError): """Raised if a double spend is found""" -class ValidationError(Exception): +class ValidationError(BigchainDBError): """Raised if there was an error in validation""" @@ -35,56 +36,56 @@ class SchemaValidationError(ValidationError): """Raised if there was any error validating an object's schema""" -class InvalidSignature(Exception): +class InvalidSignature(BigchainDBError): """Raised if there was an error checking the signature for a particular operation""" -class DatabaseAlreadyExists(Exception): +class DatabaseAlreadyExists(BigchainDBError): """Raised when trying to create the database but the db is already there""" -class DatabaseDoesNotExist(Exception): +class DatabaseDoesNotExist(BigchainDBError): """Raised when trying to delete the database but the db is not there""" -class KeypairNotFoundException(Exception): +class KeypairNotFoundException(BigchainDBError): """Raised if operation cannot proceed because the keypair was not given""" -class KeypairMismatchException(Exception): +class KeypairMismatchException(BigchainDBError): """Raised if the private key(s) provided for signing don't match any of the current owner(s)""" -class StartupError(Exception): +class StartupError(BigchainDBError): """Raised when there is an error starting up the system""" -class ImproperVoteError(Exception): +class ImproperVoteError(BigchainDBError): """Raised if a vote is not constructed correctly, or signed incorrectly""" -class MultipleVotesError(Exception): +class MultipleVotesError(BigchainDBError): """Raised if a voter has voted more than once""" -class GenesisBlockAlreadyExistsError(Exception): +class GenesisBlockAlreadyExistsError(BigchainDBError): """Raised when trying to create the already existing genesis block""" -class CyclicBlockchainError(Exception): +class CyclicBlockchainError(BigchainDBError): """Raised when there is a cycle in the blockchain""" -class TransactionNotInValidBlock(Exception): +class TransactionNotInValidBlock(BigchainDBError): """Raised when a transfer transaction is attempting to fulfill the outputs of a transaction that is in an invalid or undecided block""" -class AssetIdMismatch(Exception): +class AssetIdMismatch(BigchainDBError): """Raised when multiple transaction inputs related to different assets""" -class AmountError(Exception): +class AmountError(BigchainDBError): """Raised when there is a problem with a transaction's output amounts"""