jakesgordon / javascript-state-machine

A javascript finite state machine library
MIT License
8.69k stars 964 forks source link

Cancel state transition when exception is thrown inside observer #184

Open NelsonFrancisco opened 5 years ago

NelsonFrancisco commented 5 years ago

171 related

When you throw an exception inside an observer the FSM state might be updated:

This PR makes this consistent, and it always reverts the state. It basically reverts to the previous state when the exception is thrown IF the current state is different from the previous one, defined in the transition. Promises supported