refactoring error message handling - 5 - continued