comparison 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
comparison
equal deleted inserted replaced
17:de6a296744f7 18:0170f449f924
146 start_time = time.clock() 146 start_time = time.clock()
147 proc.process(full_path, self.out_dir) 147 proc.process(full_path, self.out_dir)
148 print_node(format_timed(start_time, "(bypassing structured processing)")) 148 print_node(format_timed(start_time, "(bypassing structured processing)"))
149 return True 149 return True
150 except Exception as e: 150 except Exception as e:
151 import sys 151 raise Exception("Error processing: %s" % node.path) from e
152 _, __, traceback = sys.exc_info()
153 raise Exception("Error processing: %s" % node.path, e).with_traceback(traceback)
154 152
155 # All outputs of a node must go to the same directory, so we can get 153 # All outputs of a node must go to the same directory, so we can get
156 # the output directory off of the first output. 154 # the output directory off of the first output.
157 base_out_dir = self._getNodeBaseDir(node.outputs[0]) 155 base_out_dir = self._getNodeBaseDir(node.outputs[0])
158 rel_out_dir = os.path.dirname(node.path) 156 rel_out_dir = os.path.dirname(node.path)
176 return True 174 return True
177 else: 175 else:
178 print_node(node, "-> %s [clean]" % out_dir) 176 print_node(node, "-> %s [clean]" % out_dir)
179 return False 177 return False
180 except Exception as e: 178 except Exception as e:
181 import sys 179 raise Exception("Error processing: %s" % node.path) from e
182 _, __, traceback = sys.exc_info()
183 raise Exception("Error processing: %s" % node.path, e).with_traceback(traceback)
184 180
185 def _computeNodeState(self, node): 181 def _computeNodeState(self, node):
186 if node.state != STATE_UNKNOWN: 182 if node.state != STATE_UNKNOWN:
187 return 183 return
188 184