Simplify exception factory logic