Having such situation - launching a code at the end of night which inserts records and once a while it appears duplicate unique key which causes a RAISERROR block to appear with error that cannot insert duplicate keys and then it stops procedure till this part is not fixed.
It is possible to have these critical errors in a log file only, but it will proceed further with other good lines and finish procedure?