exception refactoring