diff options
author | Sylvain Desbureaux <sylvain.desbureaux@orange.com> | 2020-12-01 17:49:31 +0100 |
---|---|---|
committer | Sylvain Desbureaux <sylvain.desbureaux@orange.com> | 2020-12-01 17:51:56 +0100 |
commit | 9c71e24adaaedd07d7e2e65922c5a3cee27318c9 (patch) | |
tree | a47f904d81a6afbadd8b451563d34fcd974e6bcd /src/onaptests/scenario/basic_network.py | |
parent | a6fe8be6c1d1eb9e7293ed1c3bb63a76646fe22c (diff) |
Better exception handling
Instead of catching all exceptions that can occurs and miss one, let's
create a "parent" exception class for OnapTest and catch only this one.
In order to know what's the error, we also create a class attribute
(`error_message`) that gives us the reason for exception.
Issue-ID: INT-1796
Signed-off-by: Sylvain Desbureaux <sylvain.desbureaux@orange.com>
Change-Id: I798d8c6270c466b1d9be6511f52fd9441401c9c8
Diffstat (limited to 'src/onaptests/scenario/basic_network.py')
-rw-r--r-- | src/onaptests/scenario/basic_network.py | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/src/onaptests/scenario/basic_network.py b/src/onaptests/scenario/basic_network.py index de465d3..8aafd32 100644 --- a/src/onaptests/scenario/basic_network.py +++ b/src/onaptests/scenario/basic_network.py @@ -46,18 +46,9 @@ class BasicNetwork(testcase.TestCase): else: self.__logger.info("No cleanup requested. Test completed.") self.result = 100 - except onap_test_exceptions.ServiceInstantiateException: - self.__logger.error("Basic network service instantiation failed.") - self.result = 0 - except onap_test_exceptions.ServiceInstantiateException: - self.__logger.error("Basic network service cleanup failed.") - self.result = 0 - except onap_test_exceptions.NetworkInstantiateException: - self.__logger.error("Basic network VL instantiation failed.") - self.result = 0 - except onap_test_exceptions.NetworkCleanupException: - self.__logger.error("Basic network VL cleanup failed.") + except onap_test_exceptions.OnapTestException as exc: self.result = 0 + self.__logger.error(exc.error_message) finally: self.stop_time = time.time() |