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
doc = ccall(sbml(:readSBML), VPtr, (Cstring,), fn)
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
throw(SystemError("Opening SBML document has failed"))
throw(AssertionError("Opening SBML document has reported errors"))
if 0 == ccall(sbml(:SBMLDocument_isSetModel), Cint, (VPtr,), doc)
Supports Markdown
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