From 7a80bd96262383dc3597b769e60dfad8ccc9b883 Mon Sep 17 00:00:00 2001 From: Vratko Polak Date: Tue, 14 Aug 2018 10:23:21 +0200 Subject: [PATCH] PAL improvement: Log repr() of PresentationError Change-Id: I491e3a77dda06e6a1caa34f70baaef9751674fbd Signed-off-by: Vratko Polak --- resources/tools/presentation/errors.py | 4 +++- resources/tools/presentation/pal.py | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/resources/tools/presentation/errors.py b/resources/tools/presentation/errors.py index 0d8d5b9b33..64084f6a40 100644 --- a/resources/tools/presentation/errors.py +++ b/resources/tools/presentation/errors.py @@ -63,7 +63,9 @@ class PresentationError(Exception): sys.exit(1) def __repr__(self): - return repr(self._msg) + return ( + "PresentationError(msg={msg!r},details={dets!r},level={level!r})". + format(msg=self._msg, dets=self._details, level=self._level)) def __str__(self): return str(self._msg) diff --git a/resources/tools/presentation/pal.py b/resources/tools/presentation/pal.py index 73d3b757aa..a6b4d58bcf 100644 --- a/resources/tools/presentation/pal.py +++ b/resources/tools/presentation/pal.py @@ -116,10 +116,10 @@ def main(): except (KeyError, ValueError, PresentationError) as err: logging.info("Finished with an error.") - logging.critical(str(err)) + logging.critical(repr(err)) except Exception as err: logging.info("Finished with an unexpected error.") - logging.critical(str(err)) + logging.critical(repr(err)) finally: if spec is not None: clean_environment(spec.environment) -- 2.16.6