Adding error handler.