Unverified Commit a4ed3eae authored by Miroslav Kratochvil's avatar Miroslav Kratochvil Committed by GitHub
Browse files

Merge pull request #73 from giordano/mg/get_string

Strip whitespaces when reporting error messages from `readSBML`
parents 1721265b 3da6281d
......@@ -99,8 +99,8 @@ function readSBML(fn::String, sbml_conversion = document -> nothing)::SBML.Model
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 = get_string(err, :XMLError_getMessage)
@warn "SBML reported error: $msg"
msg = strip(get_string(err, :XMLError_getMessage))
@error "SBML reported error: $msg"
if n_errs > 0
throw(AssertionError("Opening SBML document has reported errors"))
......@@ -18,8 +18,7 @@ end
@test typeof(mdl) == Model
@info "The next warning is an expected side-effect of testing an error condition"
@test_throws AssertionError readSBML(sbmlfile * ".does.not.really.exist")
@test_logs (:error, "SBML reported error: File unreadable.") @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