summaryrefslogtreecommitdiff
path: root/lib/automata.py
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2019-12-12 08:08:43 +0100
committerDaniel Friesel <daniel.friesel@uos.de>2019-12-12 08:08:43 +0100
commitc87b4df4ef7d138d80768951a06107c3b66f46ab (patch)
tree3c415fc36f10f7b2dfb418a8b6ab58c67af78d07 /lib/automata.py
parenteedaeb712c41686f79f5c7f096265a929a079114 (diff)
automata.State: improve error message on missing transition
Diffstat (limited to 'lib/automata.py')
-rwxr-xr-xlib/automata.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/automata.py b/lib/automata.py
index 8e889aa..db7caf0 100755
--- a/lib/automata.py
+++ b/lib/automata.py
@@ -142,7 +142,10 @@ class State:
:param transition_name: transition name
:returns: `Transition` object
"""
- return self.outgoing_transitions[transition_name]
+ try:
+ return self.outgoing_transitions[transition_name]
+ except KeyError:
+ raise ValueError('State {} has no outgoing transition called {}'.format(self.name, transition_name)) from None
def has_interrupt_transitions(self) -> bool:
"""Return whether this state has any outgoing interrupt transitions."""