ErrorHandler refactoring