repeatingbeats/statem — pull request #4 by repeatingbeats (2013-02-19 22:28:23+00:00)
Title: Invalid events have undefined behavior

There is currently no defined behavior for invalid events, and it's possible to force the machine into an undefined state by sending a known event to a state that does not respond to that event.

To be specific, an invalid event occurs when the machine is signalled an event with `send`, but the machine is in a state that does not respond to the event.

The example machine does not respond to 'done' in the 'ready' state.

![Example Statem Machine Diagram](http://www.repeatingbeats.com/images/statem-271cde30.png)

This results in a bug where the machine can enter an undefined state.
```js
machine.state(); // 'ready'
machine.send('done');
machine.state(); // undefined
```
Since this bug is a result of not defining this behavior in the first place, it should be fixed by defining then implementing behavior for this case.

Options:

1. Ignore invalid events

2. Throw on invalid events

The former is simpler; the latter is probably more helpful for debugging. Or it could be configurable.