Commit b24d1b13 authored by Miroslav Kratochvil's avatar Miroslav Kratochvil
Browse files

juliaformatter

parent 1f0b8e29
......@@ -6,11 +6,18 @@ A converter to pass into [`readSBML`](@ref) that enforces certain SBML level
and version.
"""
set_level_and_version(level, version) =
doc -> check_errors(ccall(sbml(:SBMLDocument_setLevelAndVersion), Cint,
(VPtr, Cint, Cint),
doc, level, version),
doc,
ErrorException("Setting of level and version did not succeed"))
doc -> check_errors(
ccall(
sbml(:SBMLDocument_setLevelAndVersion),
Cint,
(VPtr, Cint, Cint),
doc,
level,
version,
),
doc,
ErrorException("Setting of level and version did not succeed"),
)
"""
libsbml_convert(conversion_options::Vector{Pair{String, Dict{String, String}}})
......@@ -38,8 +45,11 @@ libsbml_convert(
opt,
)
end
check_errors(ccall(sbml(:SBMLDocument_convert), Cint, (VPtr, VPtr), doc, props),
doc, ErrorException("Conversion returned errors"))
check_errors(
ccall(sbml(:SBMLDocument_convert), Cint, (VPtr, VPtr), doc, props),
doc,
ErrorException("Conversion returned errors"),
)
end
end
......
......@@ -93,8 +93,7 @@ end)
function readSBML(fn::String, sbml_conversion = document -> nothing)::SBML.Model
doc = ccall(sbml(:readSBML), VPtr, (Cstring,), fn)
try
get_error_messages(doc,
AssertionError("Opening SBML document has reported errors"))
get_error_messages(doc, AssertionError("Opening SBML document has reported errors"))
sbml_conversion(doc)
......
......@@ -142,7 +142,7 @@ Show the error messages reported by SBML in the `doc` document and throw the
function get_error_messages(doc::VPtr, error::Exception)
n_errs = ccall(sbml(:SBMLDocument_getNumErrors), Cuint, (VPtr,), doc)
for i = 1:n_errs
err = ccall(sbml(:SBMLDocument_getError), VPtr, (VPtr, Cuint), doc, i-1)
err = ccall(sbml(:SBMLDocument_getError), VPtr, (VPtr, Cuint), doc, i - 1)
msg = string(strip(get_string(err, :XMLError_getMessage)))
@error "SBML reported error: $(msg)"
end
......
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