update to 0.0.5

- emit ‘error’ event
- add tests of error cases