Handle error event.  Closes #47