Only add the error handler in non-production environments.