From a1fdc66e4e9e81454be664f2fb9e11e3bf1a31bd Mon Sep 17 00:00:00 2001 From: Pranesh Pandurangan Date: Tue, 10 Jun 2014 19:28:47 -0700 Subject: [PATCH] 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 --- entropy/exceptions.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/entropy/exceptions.py b/entropy/exceptions.py index 7797784..459385d 100644 --- a/entropy/exceptions.py +++ b/entropy/exceptions.py @@ -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)