Add some exception classes

Added NoSuchEngineException and NoEnginesException classes, which
will allow better exception handling in the code, instead of just
raising generic Exception.

Change-Id: Ic9104dda3b1e5414ae11e8576a4ad29961be5e95
This commit is contained in:
Pranesh Pandurangan 2014-06-10 19:28:47 -07:00
parent 81a9042ff1
commit a1fdc66e4e
1 changed files with 13 additions and 0 deletions

View File

@ -33,3 +33,16 @@ class EngineStoppedException(EntropyException):
"""Exception raised when engine is shutdown."""
def __init__(self, message):
super(EngineStoppedException, self).__init__(message)
class NoSuchEngineException(EntropyException):
"""Exception raised when performing operations on a non-existent engine.
"""
def __init__(self, message):
super(NoSuchEngineException, self).__init__(message)
class NoEnginesException(EntropyException):
"""Exception raised when there are no known engines."""
def __init__(self, message):
super(NoEnginesException, self).__init__(message)