recode print_error function