Adding custom error handler.