Skip to main content

InvalidStateTransitionError

Overview​

Type: class

An error thrown by SimpleFiniteStateManager when attempting to change a state without conforming to the allowedStateTransitions in the constructor. You may create instances of this error or even extend it, but there is almost never a scenario in which this is necessary.

export class InvalidStateTransitionError extends Error

Constructor​

constructor(fromState: string, toState: string, stateManager?: string)

Parameters​

  • fromState — The value of the state which is it changing from.
    Type: string
    Required: Yes
  • toState — The value of the state which is it changing to.
    Type: string
    Required: Yes
  • stateManager — The display name. Only used for debugging.
    Type: string
    Required: No — (default value: undefined)

Message Format​

For state manager with name​

Invalid state transition from "fromState" to "toState" in stateManager

For state manager without name​

Invalid state transition from "fromState" to "toState"

Message Example​

For state manager with name​

Invalid state transition from "A" to "B" in ExampleState

For state manager without name​

Invalid state transition from "A" to "B"

Properties​

fromState​

The value of the state which is it changing from.

readonly fromState: string

toState​

The value of the state which is it changing to.

readonly toState: string

stateManager​

The display name of the state manager.

readonly stateManagerName?: string | undefined | null