Fix CustomEventEmitter error handling

Override .emit() to first check whether the error argument is an array. In case
it is an array, reduce it to the very first error and pass it to the original
EventEmitter.emit()