Commit 8be4d18c authored by Miroslav Kratochvil's avatar Miroslav Kratochvil
Browse files

Be more verbose when reporting SBML opening errors

parent 83412adb
...@@ -10,8 +10,13 @@ function readSBML(fn::String)::Model ...@@ -10,8 +10,13 @@ function readSBML(fn::String)::Model
doc = ccall(sbml(:readSBML), VPtr, (Cstring,), fn) doc = ccall(sbml(:readSBML), VPtr, (Cstring,), fn)
try try
n_errs = ccall(sbml(:SBMLDocument_getNumErrors), Cuint, (VPtr,), doc) n_errs = ccall(sbml(:SBMLDocument_getNumErrors), Cuint, (VPtr,), doc)
for i = 0:n_errs-1
err = ccall(sbml(:SBMLDocument_getError), VPtr, (VPtr, Cuint), doc, i)
msg = unsafe_string(ccall(sbml(:XMLError_getMessage), Cstring, (VPtr,), err))
@warn "SBML reported error: $msg"
if n_errs > 0 if n_errs > 0
throw(SystemError("Opening SBML document has failed")) throw(AssertionError("Opening SBML document has reported errors"))
end end
if 0 == ccall(sbml(:SBMLDocument_isSetModel), Cint, (VPtr,), doc) if 0 == ccall(sbml(:SBMLDocument_isSetModel), Cint, (VPtr,), doc)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment