Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throw an exception when a transition is cancelled. #182

Open
ghost opened this issue May 13, 2019 · 0 comments
Open

Throw an exception when a transition is cancelled. #182

ghost opened this issue May 13, 2019 · 0 comments

Comments

@ghost
Copy link

ghost commented May 13, 2019

Good day!

In my current project, I realized my code would benefit a lot by the possibility of throwing an exception and catching it when a transition is cancelled (because in my case the transition is cancelled if some particular conditions are not met).

I've modified my fork of javascript-state-machine to include a new handler called "onCancelledTransition" that by default returns false (as expected) when a transition is cancelled, but it allows a custom implementation of onCancelledTransition handler where you can throw an error whenever one of a set of particular lifecycle events returns false (the same as onInvalidTransition and onPendingTransition).

Does the project is interested in my addition (cancelledTransition)? I could made a PR if so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants