refactoring error messages