Browse Source

Merge "Replace some generic Exceptions with specific ones"

Jenkins 4 years ago
parent
commit
7891dd8eb9
1 changed files with 4 additions and 2 deletions
  1. 4
    2
      entropy/utils.py

+ 4
- 2
entropy/utils.py View File

@@ -23,6 +23,8 @@ from watchdog.events import FileSystemEventHandler
23 23
 from watchdog.observers import Observer
24 24
 import yaml
25 25
 
26
+from entropy import exceptions
27
+
26 28
 LOG = logging.getLogger(__name__)
27 29
 
28 30
 
@@ -139,9 +141,9 @@ def purge_disabled(cfg_file):
139 141
 def disable_engine(name, cfg_file):
140 142
     engines = load_yaml(cfg_file)
141 143
     if not engines:
142
-        raise Exception("No engines at all!")
144
+        raise exceptions.NoEnginesException("No known engine!")
143 145
     if name not in engines:
144
-        raise Exception("No such engine!")
146
+        raise exceptions.NoSuchEngineException("No engines called %s!", name)
145 147
     engines[name]['enabled'] = False
146 148
     write_yaml(engines, cfg_file, append=False)
147 149
     return engines[name]['pid']

Loading…
Cancel
Save