Fix error handling in getString and simplify callers.