Exception refactoring