add error case to Mag.inferType