changeset 272:a561fbad0b7f

logging: If an error doesn't have a message, print its type.
author Ludovic Chabant <ludovic@chabant.com>
date Sun, 01 Mar 2015 09:07:02 -0800
parents 12657039c436
children d70a4adb61dd
files piecrust/chefutil.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/piecrust/chefutil.py	Sun Mar 01 09:06:32 2015 -0800
+++ b/piecrust/chefutil.py	Sun Mar 01 09:07:02 2015 -0800
@@ -14,7 +14,10 @@
 def log_friendly_exception(logger, ex):
     indent = ''
     while ex:
-        logger.error('%s%s' % (indent, str(ex)))
+        ex_msg = str(ex)
+        if not ex_msg:
+            ex_msg = '%s exception was thrown' % type(ex).__name__
+        logger.error('%s%s' % (indent, ex_msg))
         indent += '  '
         ex = ex.__cause__