Skip to content

Error handling #10

@vorg

Description

@vorg

Currently emitting invalid state transition emits error nanostate.emit: invalid transition ${this.state} -> ${eventName}.

Do you have any ideas on how to handle those errors? E.g.

var machine = nanostate('cash', {
  cash: { check: 'check' },
  check: { cash: 'cash' }
})

machine.onError((e) => {
  console.log(error)
  throw e
})

machine.emit('robbery')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions