this seems to do something different. Emit 'error' only happens if someone calls setError. Do we need this here?