Browse Source

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
Pranesh Pandurangan 4 years ago
parent
commit
a1fdc66e4e
1 changed files with 13 additions and 0 deletions
  1. 13
    0
      entropy/exceptions.py

+ 13
- 0
entropy/exceptions.py View File

@@ -33,3 +33,16 @@ class EngineStoppedException(EntropyException):
33 33
     """Exception raised when engine is shutdown."""
34 34
     def __init__(self, message):
35 35
         super(EngineStoppedException, self).__init__(message)
36
+
37
+
38
+class NoSuchEngineException(EntropyException):
39
+    """Exception raised when performing operations on a non-existent engine.
40
+    """
41
+    def __init__(self, message):
42
+        super(NoSuchEngineException, self).__init__(message)
43
+
44
+
45
+class NoEnginesException(EntropyException):
46
+    """Exception raised when there are no known engines."""
47
+    def __init__(self, message):
48
+        super(NoEnginesException, self).__init__(message)

Loading…
Cancel
Save