fixed repeat code into gen_cc_errors method