PAL improvement: Log repr() of PresentationError 95/14195/5
authorVratko Polak <vrpolak@cisco.com>
Tue, 14 Aug 2018 08:23:21 +0000 (10:23 +0200)
committerTibor Frank <tifrank@cisco.com>
Mon, 20 Aug 2018 08:19:34 +0000 (08:19 +0000)
Change-Id: I491e3a77dda06e6a1caa34f70baaef9751674fbd
Signed-off-by: Vratko Polak <vrpolak@cisco.com>
resources/tools/presentation/errors.py
resources/tools/presentation/pal.py

index 0d8d5b9..64084f6 100644 (file)
@@ -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)
index 73d3b75..a6b4d58 100644 (file)
@@ -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)