Unverified Commit 08ffba87 authored by Laurent Heirendt's avatar Laurent Heirendt Committed by GitHub
Browse files

Merge pull request #17 from LCSB-BioCore/error-reporting

Be more verbose when reporting SBML opening errors
parents 83412adb c9e68bc2
......@@ -10,8 +10,13 @@ function readSBML(fn::String)::Model
doc = ccall(sbml(:readSBML), VPtr, (Cstring,), fn)
try
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"
end
if n_errs > 0
throw(SystemError("Opening SBML document has failed"))
throw(AssertionError("Opening SBML document has reported errors"))
end
if 0 == ccall(sbml(:SBMLDocument_isSetModel), Cint, (VPtr,), doc)
......
......@@ -15,7 +15,7 @@ end
@test typeof(mdl) == Model
@test_throws SystemError readSBML(sbmlfile * ".does.not.really.exist")
@test_throws AssertionError readSBML(sbmlfile * ".does.not.really.exist")
@test length(mdl.compartments) == 2
......
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