title: More graceful error handling in C++ library - jsoncpp
body: <p>I'm not sure if this will be a specific thing with jsoncpp or a general paradigm with how to make a C++ library behave better.  Basically I'm getting this trace:</p>
  
  <pre><code>imagegeneratormanager.tsk: src/lib_json/json_value.cpp:1176: const Json::Value&amp;     Json::Value::operator[](const char*) const: Assertion `type_ == nullValue || type_ == objectValue' failed.
  </code></pre>
  
  <p>That happens when the input is bad.  When the input - which is coming from another application of mine via memcached - happens to be bad, I would like to handle this error.  You know, gracefully.  Perhaps something like, "error: input for item 15006 is bad" going to the log.  Not crashing my entire JSON-string-processing task.</p>
  
  <p>Is this just a badly written library or is it possible to configure it more subtly?</p>
  
  <p>Edit:  here's some calling code:</p>
  
  <pre><code>Json::Value root;
  Json::Reader reader;
  succeeded = reader.parse(jsonString, root);
  
  if(!succeeded) {
    throw std::runtime_error(std::string("Failed to parse JSON for key ")  + emailInfoKey.str());
  }
  
  std::string userEmail = root.get("userId", "").asString();
  std::string bodyFilePath = root.get("bodyFilePath", "").asString();
  std::string msgId = root.get("msgId", "").asString();
  </code></pre>