Move catch_command_errors and catch_command_errors_const to main.c