Added a custom error handler.