Commit a81f3a0c authored by VIGNET Pierre's avatar VIGNET Pierre
Browse files

[cmd] Better handling of errors when no valid path was found

parent 99153be3
......@@ -140,7 +140,7 @@ def build_graph(solution, steps, transitions):
# In case of error, inhibitors_nodes can be wrongly modified...
inhibitors_nodes = temp_inihibtors_nodes
except AssertionError as e:
except AssertionError:
"No valid path for the event '%s' in the solution '%s'.\n"
"Most of the time it is just an artefact from the solver. "
......@@ -148,7 +148,6 @@ def build_graph(solution, steps, transitions):
LOGGER.debug("Exception returned: %s", str(e))
event = attributes['label'].split('[')[0]
......@@ -315,6 +315,8 @@ def parse_condition(condition, all_nodes, inhibitors_nodes):
.. note:: inhibitors_nodes is modified(set) by this function.
:raises AssertionError: If no valid path was found.
:param condition: Condition string of a transition.
:param all_nodes: Nodes involved in transitions + frontier places.
:param inhibitors_nodes: Inactivated nodes in paths of conditions.
......@@ -372,7 +374,9 @@ def parse_condition(condition, all_nodes, inhibitors_nodes):
isinsubset = pruned_places.issubset(all_nodes)
LOGGER.debug("PRUNED PATH: %s, VALID: %s", pruned_places, isinsubset)
assert valid_paths, "No valid path in the model for: " + str(condition)
if not valid_paths:
LOGGER.debug("No valid path in the model for condition: %s", condition)
raise AssertionError("No valid path in the model for condition: " + str(condition))
return valid_paths
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