You have an idea for a feature that would make transitions more helpful or easier to use? Great! We are looking forward to your suggestion.
Is your feature request related to a problem? Please describe.
Currently, when an exception occurs during a transition (in before, after, on_enter, or on_exit callbacks), the flow is interrupted and the exception must be handled externally via try/except in the application code. This forces developers to step outside of the FSM logic, breaking cohesion and increasing maintenance complexity.
Describe the solution you'd like
It would be helpful to allow transitions to specify an alternative target state in case of an exception. If an error occurs during the execution of a transition, the machine should automatically redirect to a user-defined “error” state. This would make exceptions part of the FSM graph itself, keeping error handling consistent within the state machine model and avoiding the need to capture exceptions outside of it.
Additional context
This feature would be especially valuable in scenarios where workflows must explicitly define failure paths, such as business processes, orchestration systems, or critical applications where each transition may have both a success route and a failure route. This would make FSM modeling more expressive and aligned with real-world expectations.
You have an idea for a feature that would make
transitionsmore helpful or easier to use? Great! We are looking forward to your suggestion.Is your feature request related to a problem? Please describe.
Currently, when an exception occurs during a transition (in before, after, on_enter, or on_exit callbacks), the flow is interrupted and the exception must be handled externally via try/except in the application code. This forces developers to step outside of the FSM logic, breaking cohesion and increasing maintenance complexity.
Describe the solution you'd like
It would be helpful to allow transitions to specify an alternative target state in case of an exception. If an error occurs during the execution of a transition, the machine should automatically redirect to a user-defined “error” state. This would make exceptions part of the FSM graph itself, keeping error handling consistent within the state machine model and avoiding the need to capture exceptions outside of it.
Additional context
This feature would be especially valuable in scenarios where workflows must explicitly define failure paths, such as business processes, orchestration systems, or critical applications where each transition may have both a success route and a failure route. This would make FSM modeling more expressive and aligned with real-world expectations.