Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
VIGNET Pierre
cadbiom
Commits
1a277f96
Commit
1a277f96
authored
Feb 20, 2020
by
VIGNET Pierre
Browse files
[lib] Improve error handling during the parsing of conditions/events
parent
492edf96
Changes
3
Hide whitespace changes
Inline
Side-by-side
command_line/cadbiom_cmd/solution_search.py
View file @
1a277f96
...
...
@@ -57,7 +57,7 @@ import cadbiom.commons as cm
LOGGER
=
cm
.
logger
()
class
ErrorRep
(
object
):
class
ErrorRep
orter
(
object
):
"""Cf class CompilReporter(object):
gt_gui/utils/reporter.py
"""
...
...
@@ -68,11 +68,11 @@ class ErrorRep(object):
def
display
(
self
,
mess
):
self
.
error
=
True
LOGGER
.
error
(
"
>>
Context: %s; %s"
,
self
.
context
,
mess
)
LOGGER
.
error
(
"
solution_search::
Context: %s; %s"
,
self
.
context
,
mess
)
exit
()
def
display_info
(
self
,
mess
):
LOGGER
.
error
(
"
--
Context: %s; %s"
,
self
.
context
,
mess
)
LOGGER
.
error
(
"
solution_search::
Context: %s; %s"
,
self
.
context
,
mess
)
exit
()
def
set_context
(
self
,
cont
):
...
...
@@ -206,7 +206,7 @@ def search_entry_point(
:type limit: <int>
"""
# Build MCLA with Error Reporter
mcla
=
MCLAnalyser
(
ErrorRep
())
mcla
=
MCLAnalyser
(
ErrorRep
orter
())
# Load model file
detect_model_type
(
mcla
,
model_file
)(
model_file
)
...
...
@@ -484,7 +484,7 @@ def detect_model_type(mclanalyser, filepath):
# start_prop = mac_p
#
# # BUILD MCLA
# error_reporter = ErrorRep()
# error_reporter = ErrorRep
orter
()
# mcla = MCLAnalyser(error_reporter)
# mcla.build_from_chart_file(model_file)
#
...
...
command_line/cadbiom_cmd/tools/models.py
View file @
1a277f96
...
...
@@ -53,8 +53,10 @@ LOGGER = cm.logger()
class
Reporter
(
object
):
"""Error reporter.
.. note:: Link the lexer to the model allows to avoid error in Reporter
like: "-> dec -> Undeclared event or state"
.. note:: Link the lexer to the model allows to avoid some errors in Reporter.
We mask error like: "-> dec -> Undeclared event or state".
This error is generated for every place in a condition/event and should
only mean that an item has never been met.
In practice this is time consuming and useless for what we want to do.
See parse_condition()
"""
...
...
@@ -63,11 +65,14 @@ class Reporter(object):
self
.
error
=
False
self
.
mess
=
""
def
display
(
self
,
err
):
def
display
(
self
,
err
or_msg
):
"""Display the error in the logger"""
self
.
error
=
True
if
"Undeclared event or state"
not
in
err
:
LOGGER
.
error
(
"
\t
"
+
self
.
mess
+
" -> "
+
err
)
if
"Undeclared event or state"
in
error_msg
:
return
LOGGER
.
error
(
"Event or condition parser:: %s"
,
error_msg
)
def
get_transitions_from_model_file
(
model_file
):
...
...
library/cadbiom/models/guard_transitions/analyser/model_corrections.py
View file @
1a277f96
...
...
@@ -55,11 +55,11 @@ class ErrorRep(object):
def
display
(
self
,
mess
):
self
.
error
=
True
LOGGER
.
error
(
"
>>
Context: {}; {}"
.
format
(
self
.
context
,
mess
))
LOGGER
.
error
(
"
add_start_nodes::
Context: {}; {}"
.
format
(
self
.
context
,
mess
))
exit
()
def
display_info
(
self
,
mess
):
LOGGER
.
error
(
"
--
Context: {}; {}"
.
format
(
self
.
context
,
mess
))
LOGGER
.
error
(
"
add_start_nodes::
Context: {}; {}"
.
format
(
self
.
context
,
mess
))
exit
()
def
set_context
(
self
,
cont
):
...
...
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