Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3671)

Unified Diff: chrome/common/json_value_serializer.cc

Issue 13169: Add error messages to JSONReader and friends. This required a bit of refactor... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/common/json_value_serializer.cc
===================================================================
--- chrome/common/json_value_serializer.cc (revision 6390)
+++ chrome/common/json_value_serializer.cc (working copy)
@@ -21,11 +21,14 @@
return true;
}
-bool JSONStringValueSerializer::Deserialize(Value** root) {
+bool JSONStringValueSerializer::Deserialize(Value** root,
+ std::string* error_message) {
if (!json_string_)
return false;
- return JSONReader::Read(*json_string_, root, allow_trailing_comma_);
+ return JSONReader::ReadAndReturnError(*json_string_, root,
+ allow_trailing_comma_,
+ error_message);
}
/******* File Serializer *******/
@@ -47,12 +50,13 @@
return true;
}
-bool JSONFileValueSerializer::Deserialize(Value** root) {
+bool JSONFileValueSerializer::Deserialize(Value** root,
+ std::string* error_message) {
std::string json_string;
if (!file_util::ReadFileToString(json_file_path_, &json_string)) {
return false;
}
JSONStringValueSerializer serializer(json_string);
- return serializer.Deserialize(root);
+ return serializer.Deserialize(root, error_message);
}

Powered by Google App Engine
This is Rietveld 408576698