refactoring error message handling - 8 - continued