throw graph-aware exceptions

This commit is contained in:
Mike J Innes 2017-01-29 23:35:03 +05:30
parent 3981485500
commit 349e81172d

View File

@ -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