提交 d8b8a183 authored 作者: Frederic's avatar Frederic

Make the cvm and c linker raise error message as the vm and c|py linker.

This add the op and the outputs of the apply node in the message error.
上级 8178abbd
...@@ -933,6 +933,7 @@ class CLinker(link.Linker): ...@@ -933,6 +933,7 @@ class CLinker(link.Linker):
keep_lock=keep_lock) keep_lock=keep_lock)
res = _CThunk(cthunk, init_tasks, tasks, error_storage) res = _CThunk(cthunk, init_tasks, tasks, error_storage)
res.nodes = self.node_order
return res, in_storage, out_storage return res, in_storage, out_storage
def cmodule_key(self): def cmodule_key(self):
...@@ -1391,11 +1392,9 @@ class _CThunk(object): ...@@ -1391,11 +1392,9 @@ class _CThunk(object):
trace = () trace = ()
try: try:
exc_type, _exc_value, exc_trace = self.error_storage exc_type, _exc_value, exc_trace = self.error_storage
if hasattr(task, "outputs"): self.position_of_error = self.nodes.index(task)
exc_value = exc_type(_exc_value, task, task.outputs)
else:
exc_value = exc_type(_exc_value, task)
# this can be used to retrieve the location the Op was declared # this can be used to retrieve the location the Op was declared
exc_value = exc_type(_exc_value)
exc_value.__thunk_trace__ = trace exc_value.__thunk_trace__ = trace
except Exception: except Exception:
print >> sys.stderr, ('ERROR retrieving error_storage.' print >> sys.stderr, ('ERROR retrieving error_storage.'
......
...@@ -108,6 +108,10 @@ def raise_with_op(op, exc_info=None): ...@@ -108,6 +108,10 @@ def raise_with_op(op, exc_info=None):
if raise_with_op.print_thunk_trace: if raise_with_op.print_thunk_trace:
log_thunk_trace(exc_value) log_thunk_trace(exc_value)
if hasattr(op, "outputs"):
exc_value = exc_type(exc_value, op, op.outputs)
else:
exc_value = exc_type(exc_value, op)
raise exc_type, exc_value, exc_trace raise exc_type, exc_value, exc_trace
raise_with_op.print_thunk_trace = False raise_with_op.print_thunk_trace = False
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论