diff piecrust/processing/tree.py @ 18:0170f449f924

Slightly better exception throwing in the processing pipeline.
author Ludovic Chabant <ludovic@chabant.com>
date Mon, 18 Aug 2014 16:53:26 -0700
parents 474c9882decf
children 45828c4167ad
line wrap: on
line diff
--- a/piecrust/processing/tree.py	Mon Aug 18 16:53:08 2014 -0700
+++ b/piecrust/processing/tree.py	Mon Aug 18 16:53:26 2014 -0700
@@ -148,9 +148,7 @@
                 print_node(format_timed(start_time, "(bypassing structured processing)"))
                 return True
             except Exception as e:
-                import sys
-                _, __, traceback = sys.exc_info()
-                raise Exception("Error processing: %s" % node.path, e).with_traceback(traceback)
+                raise Exception("Error processing: %s" % node.path) from e
 
         # All outputs of a node must go to the same directory, so we can get
         # the output directory off of the first output.
@@ -178,9 +176,7 @@
                 print_node(node, "-> %s [clean]" % out_dir)
                 return False
         except Exception as e:
-            import sys
-            _, __, traceback = sys.exc_info()
-            raise Exception("Error processing: %s" % node.path, e).with_traceback(traceback)
+            raise Exception("Error processing: %s" % node.path) from e
 
     def _computeNodeState(self, node):
         if node.state != STATE_UNKNOWN: