Commit 3da6281d authored by Mosè Giordano's avatar Mosè Giordano
Browse files

Strip whitespaces when reporting error messages from `readSBML`


* replace `@warn` with `@error`
* actually test the logging message in `readSBML`, instead of showing an extra
  message saying to ignore it.
parent 41a25d0d
......@@ -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