Extended the exception handler to aid debugging