refactoring error message handling - 6 - continued