Added an error event to be triggered when next is called with an error