[CS] Eliminate duplication in AMI error conversion