You can usually defer this kind of logic into a public static method of the exception