Refactoring exception templates