Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
LCSB-BioCore
SBML.jl
Commits
1d41046a
Commit
1d41046a
authored
Jul 13, 2021
by
Miroslav Kratochvil
🚴
Browse files
handle SBML error severities (don't throw on warnings)
parent
ea39152c
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/utils.jl
View file @
1d41046a
...
...
@@ -139,14 +139,25 @@ 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
)
do_throw
=
false
for
i
=
1
:
n_errs
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
if
n_errs
>
0
throw
(
error
)
sev
=
string
(
strip
(
get_string
(
err
,
:
XMLError_getSeverityAsString
)))
# keywords from `libsbml/src/sbml/xml/XMLError.cpp` xmlSeverityStringTable:
if
sev
==
"Fatal"
@error
"SBML reported fatal error:
$(msg)
"
do_throw
=
true
elseif
sev
==
"Error"
@error
"SBML reported error:
$(msg)
"
do_throw
=
true
elseif
sev
==
"Warning"
@warn
"SBML reported warning:
$(msg)
"
else
# sev=="Informational"
@info
"SBML reported:
$(msg)
"
end
end
do_throw
&&
throw
(
error
)
nothing
end
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment