Dispatch an event when there is an exception