From 349e81172d642703dc27cf578e6c283b124f9872 Mon Sep 17 00:00:00 2001 From: Mike J Innes Date: Sun, 29 Jan 2017 23:35:03 +0530 Subject: [PATCH] throw graph-aware exceptions --- src/backend/mxnet/graph.jl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/backend/mxnet/graph.jl b/src/backend/mxnet/graph.jl index 4e4161ae..2e2bc120 100644 --- a/src/backend/mxnet/graph.jl +++ b/src/backend/mxnet/graph.jl @@ -82,6 +82,9 @@ end # Error Handling +using Juno +Juno.errmsg(e::mx.MXError) = e.msg + function errnode(e::mx.MXError) m = match(r"Error in (\w+):", e.msg) m == nothing && return @@ -94,7 +97,6 @@ macro mxerr(stk, ex) catch e (isa(e, mx.MXError) && (node = errnode(e)) != nothing) || rethrow() stk = $(esc(stk)) - @show stk[node] - rethrow() + throw(DataFlow.Exception(e, DataFlow.totrace(stk[node]))) end) end