Refactored error message handling in resolvers.