From 923b3bf0ae6c2462fe0d8adf404e757be5301a95 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Tue, 24 Mar 2020 10:34:19 -0400 Subject: [PATCH] sanitycheck: Add named exceptions Add named exceptions instead of a generic one. Should help point to the right issue when something goes wrong. Signed-off-by: Anas Nashif --- scripts/sanitycheck | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/sanitycheck b/scripts/sanitycheck index d18832c605e..e54bc09f39a 100755 --- a/scripts/sanitycheck +++ b/scripts/sanitycheck @@ -2665,8 +2665,12 @@ class TestSuite: tests_to_run = len(self.instances) logger.info("%d tests passed already, retrying %d tests" % (total_tests - tests_to_run, tests_to_run)) - except Exception: - logger.error("Couldn't find input file with list of tests.") + except KeyError as e: + logger.error("Key error while parsing tests file.({})".format(str(e))) + sys.exit(2) + + except FileNotFoundError as e: + logger.error("Couldn't find input file with list of tests. ({})".format(e)) sys.exit(2) def apply_filters(self, **kwargs):