some exception refactoring