diff options
author | Moshe <moshehoa@amdocs.com> | 2018-03-11 16:18:20 +0200 |
---|---|---|
committer | Moshe <moshehoa@amdocs.com> | 2018-03-11 16:18:38 +0200 |
commit | e01f70617a2f22b71cfce912b72a1dbb77f3f969 (patch) | |
tree | 3970cadfaba013fbc0f27ec42006a1744abdc88f /vnftest/common | |
parent | 976c2a916ea810effc34c5838b80b83bc9f8e6e0 (diff) |
add checkin+submit vlm steps to test case
Issue-ID: VNFSDK-195
Change-Id: I92dbf0c3abfbde2d6667588289c7a4ca2ccb4726
Signed-off-by: Moshe <moshehoa@amdocs.com>
Diffstat (limited to 'vnftest/common')
-rw-r--r-- | vnftest/common/exceptions.py | 40 |
1 files changed, 10 insertions, 30 deletions
diff --git a/vnftest/common/exceptions.py b/vnftest/common/exceptions.py index 9dc1ead..85cb203 100644 --- a/vnftest/common/exceptions.py +++ b/vnftest/common/exceptions.py @@ -14,8 +14,6 @@ # vnftest comment: this is a modified copy of # yardstick/common/exceptions.py -from oslo_utils import excutils - class ProcessExecutionError(RuntimeError): def __init__(self, message, returncode): @@ -24,42 +22,24 @@ class ProcessExecutionError(RuntimeError): class VnftestException(Exception): - """Base Vnftest Exception. - - To correctly use this class, inherit from it and define - a 'message' property. That message will get printf'd - with the keyword arguments provided to the constructor. - - Based on NeutronException class. - """ - message = "An unknown exception occurred." + message_tmplate = "An unknown exception occurred." def __init__(self, **kwargs): - try: - super(VnftestException, self).__init__(self.message % kwargs) - self.msg = self.message % kwargs - except Exception: # pylint: disable=broad-except - with excutils.save_and_reraise_exception() as ctxt: - if not self.use_fatal_exceptions(): - ctxt.reraise = False - # at least get the core message out if something happened - super(VnftestException, self).__init__(self.message) + self.msg = self.message_tmplate.format(**kwargs) + super(VnftestException, self).__init__() def __str__(self): return self.msg - def use_fatal_exceptions(self): - """Is the instance using fatal exceptions. - - :returns: Always returns False. - """ - return False - class FunctionNotImplemented(VnftestException): - message = ('The function "%(function_name)s" is not implemented in ' - '"%(class_name)" class.') + message_tmplate = ('The function "{function_name}" is not implemented in ' + '"{class_name}" class.') class MandatoryKeyException(VnftestException): - message = 'No value found for key %(key_name)" in "%(dict_str)"' + message_tmplate = 'No value found for key "{key_name}" in "{dict_str}"' + + +class InputParameterMissing(VnftestException): + message_tmplate = 'No value found for parameter "{param_name}" in "{source}"' |