The formatter tries to get the data field of the std::string, and to check whether that fails it just checks that the ValueObjectSP returned is not empty. But we never return empty ValueObjectSP's to indicate failure, since doing so would lose the Error object that tells you why fetching the ValueObject failed.
This patch adds a check for ValueObject::GetError().Success().
I also added a test case for this failure, and reworked the test case a bit (to use run_to_source_breakpoint). I also renamed a couple of single letter locals which don't follow the lldb coding conventions.
Side note as this could all be replaced with the one line check below, but Pavel added is assertSuccess that checks the same thing but also prints out the actual error message.