make mxerr more robust

This commit is contained in:
Mike J Innes 2017-02-23 16:58:29 +00:00
parent 21775f8c89
commit f230b7cebf
2 changed files with 2 additions and 0 deletions

View File

@ -105,6 +105,7 @@ macro mxerr(stk, ex)
catch e
(isa(e, mx.MXError) && (node = errnode(e)) != nothing) || rethrow()
stk = $(esc(stk))
haskey(stk, node) || rethrow()
throw(Exception(e, totrace(stk[node])))
end)
end

View File

@ -25,6 +25,7 @@ end
e = try mxnet(model, (10, 1))
catch e e end
@test isa(e, DataFlow.Interpreter.Exception)
@test e.trace[1].func == Symbol("Flux.Affine")
@test e.trace[2].func == :TLP
end