refactoring error message handling - 7 - continued