run_errors function