From 308cd375b921495ba9943b875641cfee5cf57b49 Mon Sep 17 00:00:00 2001 From: Pranesh Pandurangan Date: Tue, 10 Jun 2014 19:50:18 -0700 Subject: [PATCH] Replace some generic Exceptions with specific ones Replaced occurences of Exception with some specific exceptions Change-Id: Ib6d71172ad607b0cdcc99147920dc6b032b5c34c --- entropy/utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/entropy/utils.py b/entropy/utils.py index 01bc048..7e90534 100644 --- a/entropy/utils.py +++ b/entropy/utils.py @@ -23,6 +23,8 @@ from watchdog.events import FileSystemEventHandler from watchdog.observers import Observer import yaml +from entropy import exceptions + LOG = logging.getLogger(__name__) @@ -139,9 +141,9 @@ def purge_disabled(cfg_file): def disable_engine(name, cfg_file): engines = load_yaml(cfg_file) if not engines: - raise Exception("No engines at all!") + raise exceptions.NoEnginesException("No known engine!") if name not in engines: - raise Exception("No such engine!") + raise exceptions.NoSuchEngineException("No engines called %s!", name) engines[name]['enabled'] = False write_yaml(engines, cfg_file, append=False) return engines[name]['pid']