diff options
author | Daniel Friesel <daniel.friesel@uos.de> | 2019-12-12 08:08:43 +0100 |
---|---|---|
committer | Daniel Friesel <daniel.friesel@uos.de> | 2019-12-12 08:08:43 +0100 |
commit | c87b4df4ef7d138d80768951a06107c3b66f46ab (patch) | |
tree | 3c415fc36f10f7b2dfb418a8b6ab58c67af78d07 /lib | |
parent | eedaeb712c41686f79f5c7f096265a929a079114 (diff) |
automata.State: improve error message on missing transition
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/automata.py | 5 |
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.""" |