events.js: if an error occurs during emition, stop emitting.