geekq / workflow

Ruby finite-state-machine-inspired API for modeling workflow
MIT License
1.75k stars 207 forks source link

when process an unsupported event on a state, also trigger the on_error hook #167

Closed alucardpj closed 5 years ago

alucardpj commented 8 years ago

currently when process an unsupported event on a state, workflow will raise NoTransitionAllowed error but without triggering the on_error hook, so I cannot do centralized error handling, I must check the event or rescue all event triggering everywhere to handle NoTransitionAllowed exception. This PR will catch the exception to on_error hook, so I can do error handling in the hook.