Added support for the exception in the error callback