error message refactoring