Skip to main content

InvalidStateTransitionError

Overview

Type: class

An error that is thrown when attempting to change a state without conforming to the predefined state transitions.

export class InvalidStateTransitionError extends Error {}

Also see: SimpleFiniteStateManager

Constructor

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

Parameters

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

Message Format

from "fromState" to "toState" in stateManager

Example

from "A" to "B" in ExampleState

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. Only used for debugging.

readonly stateManager: string