From bdee1ff24e86e13042c9bf504a184de8296ae0f8 Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Mon, 11 Aug 2014 11:28:28 -0400 Subject: [PATCH] Standardize exception handling --- lib/ansible/cache/base.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/ansible/cache/base.py b/lib/ansible/cache/base.py index 694ac47a7b..82be7f50a0 100644 --- a/lib/ansible/cache/base.py +++ b/lib/ansible/cache/base.py @@ -1,18 +1,21 @@ +import exceptions + class BaseCacheModule(object): + def get(self, key): - raise NotImplementedError("Subclasses of {} must implement the '{}' method".format(self.__class__.__name__, self.__name__)) + raise exceptions.NotImplementedError def set(self, key, value): - raise NotImplementedError("Subclasses of {} must implement the '{}' method".format(self.__class__.__name__, self.__name__)) + raise exceptions.NotImplementedError def keys(self): - raise NotImplementedError("Subclasses of {} must implement the '{}' method".format(self.__class__.__name__, self.__name__)) + raise exceptions.NotImplementedError def contains(self, key): - raise NotImplementedError("Subclasses of {} must implement the '{}' method".format(self.__class__.__name__, self.__name__)) + raise exceptions.NotImplementedError def delete(self, key): - raise NotImplementedError("Subclasses of {} must implement the '{}' method".format(self.__class__.__name__, self.__name__)) + raise exceptions.NotImplementedError def flush(self): - raise NotImplementedError("Subclasses of {} must implement the '{}' method".format(self.__class__.__name__, self.__name__)) + raise exceptions.NotImplementedError