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 exception on the wrong event #9

Open
chirillkirkin opened this issue Jan 31, 2019 · 2 comments
Open

Throw exception on the wrong event #9

chirillkirkin opened this issue Jan 31, 2019 · 2 comments

Comments

@chirillkirkin
Copy link

What if state machine will throw an exception when we try to do transition to some state by undeclared event (sorry for my english).
For example:
declaring state machine behaviour

initialState(State.SomeState)
state<State.SomeState> {
            on<Event.SomeEvent> {
                transitionTo(State.AnotherState, SideEffect.SomeSideEffect)
            }
}

then we trying to do undeclared transition (from state "SomeState")
stateMachine.transition(Event.SomeOtherEvent) //<- there is should be thrown an exception

@zhxnlai
Copy link
Collaborator

zhxnlai commented Jan 31, 2019

@Keyrillanskiy Currently, when that happens (undeclared event), it returns a Transition.Invalid object. Does that work for you?

@chirillkirkin
Copy link
Author

@zhxnlai Just in my opinion, when FSM doing something wrong, there is should be an exception ¯_(ツ)_/¯

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

2 participants