Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
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
...
@@ -57,7 +57,7 @@ import cadbiom.commons as cm
LOGGER
=
cm
.
logger
()
LOGGER
=
cm
.
logger
()
class
ErrorRep
(
object
):
class
ErrorRep
orter
(
object
):
"""Cf class CompilReporter(object):
"""Cf class CompilReporter(object):
gt_gui/utils/reporter.py
gt_gui/utils/reporter.py
"""
"""
...
@@ -68,11 +68,11 @@ class ErrorRep(object):
...
@@ -68,11 +68,11 @@ class ErrorRep(object):
def
display
(
self
,
mess
):
def
display
(
self
,
mess
):
self
.
error
=
True
self
.
error
=
True
LOGGER
.
error
(
"
>>
Context: %s; %s"
,
self
.
context
,
mess
)
LOGGER
.
error
(
"
solution_search::
Context: %s; %s"
,
self
.
context
,
mess
)
exit
()
exit
()
def
display_info
(
self
,
mess
):
def
display_info
(
self
,
mess
):
LOGGER
.
error
(
"
--
Context: %s; %s"
,
self
.
context
,
mess
)
LOGGER
.
error
(
"
solution_search::
Context: %s; %s"
,
self
.
context
,
mess
)
exit
()
exit
()
def
set_context
(
self
,
cont
):
def
set_context
(
self
,
cont
):
...
@@ -206,7 +206,7 @@ def search_entry_point(
...
@@ -206,7 +206,7 @@ def search_entry_point(
:type limit: <int>
:type limit: <int>
"""
"""
# Build MCLA with Error Reporter
# Build MCLA with Error Reporter
mcla
=
MCLAnalyser
(
ErrorRep
())
mcla
=
MCLAnalyser
(
ErrorRep
orter
())
# Load model file
# Load model file
detect_model_type
(
mcla
,
model_file
)(
model_file
)
detect_model_type
(
mcla
,
model_file
)(
model_file
)
...
@@ -484,7 +484,7 @@ def detect_model_type(mclanalyser, filepath):
...
@@ -484,7 +484,7 @@ def detect_model_type(mclanalyser, filepath):
# start_prop = mac_p
# start_prop = mac_p
#
#
# # BUILD MCLA
# # BUILD MCLA
# error_reporter = ErrorRep()
# error_reporter = ErrorRep
orter
()
# mcla = MCLAnalyser(error_reporter)
# mcla = MCLAnalyser(error_reporter)
# mcla.build_from_chart_file(model_file)
# mcla.build_from_chart_file(model_file)
#
#
...
...
command_line/cadbiom_cmd/tools/models.py
View file @
1a277f96
...
@@ -53,8 +53,10 @@ LOGGER = cm.logger()
...
@@ -53,8 +53,10 @@ LOGGER = cm.logger()
class
Reporter
(
object
):
class
Reporter
(
object
):
"""Error reporter.
"""Error reporter.
.. note:: Link the lexer to the model allows to avoid error in Reporter
.. note:: Link the lexer to the model allows to avoid some errors in Reporter.
like: "-> dec -> Undeclared event or state"
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.
In practice this is time consuming and useless for what we want to do.
See parse_condition()
See parse_condition()
"""
"""
...
@@ -63,11 +65,14 @@ class Reporter(object):
...
@@ -63,11 +65,14 @@ class Reporter(object):
self
.
error
=
False
self
.
error
=
False
self
.
mess
=
""
self
.
mess
=
""
def
display
(
self
,
err
):
def
display
(
self
,
err
or_msg
):
"""Display the error in the logger"""
"""Display the error in the logger"""
self
.
error
=
True
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
):
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):
...
@@ -55,11 +55,11 @@ class ErrorRep(object):
def
display
(
self
,
mess
):
def
display
(
self
,
mess
):
self
.
error
=
True
self
.
error
=
True
LOGGER
.
error
(
"
>>
Context: {}; {}"
.
format
(
self
.
context
,
mess
))
LOGGER
.
error
(
"
add_start_nodes::
Context: {}; {}"
.
format
(
self
.
context
,
mess
))
exit
()
exit
()
def
display_info
(
self
,
mess
):
def
display_info
(
self
,
mess
):
LOGGER
.
error
(
"
--
Context: {}; {}"
.
format
(
self
.
context
,
mess
))
LOGGER
.
error
(
"
add_start_nodes::
Context: {}; {}"
.
format
(
self
.
context
,
mess
))
exit
()
exit
()
def
set_context
(
self
,
cont
):
def
set_context
(
self
,
cont
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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