summaryrefslogtreecommitdiffstats
path: root/chrome/common/json_value_serializer.h
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-05 22:14:46 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-05 22:14:46 +0000
commit88e7284573598db75013dbcbd9debb311b1e255c (patch)
tree461d3f5f16f91ea1297e682b1af86223b04850c4 /chrome/common/json_value_serializer.h
parent0649e694427d24bdfe7fec6835a44cff674a8325 (diff)
downloadchromium_src-88e7284573598db75013dbcbd9debb311b1e255c.zip
chromium_src-88e7284573598db75013dbcbd9debb311b1e255c.tar.gz
chromium_src-88e7284573598db75013dbcbd9debb311b1e255c.tar.bz2
Add error messages to JSONReader and friends. This required a bit of refactoring to do cleanly. This CL doesn't actually use this capability anywhere except for unit tests. I will add that in a future CL.
Review URL: http://codereview.chromium.org/13169 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6459 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/json_value_serializer.h')
-rw-r--r--chrome/common/json_value_serializer.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/chrome/common/json_value_serializer.h b/chrome/common/json_value_serializer.h
index a86369d..2e581ee 100644
--- a/chrome/common/json_value_serializer.h
+++ b/chrome/common/json_value_serializer.h
@@ -41,8 +41,10 @@ class JSONStringValueSerializer : public ValueSerializer {
// in to the constructor into a structure of Value objects. If the return
// value is true, the |root| parameter will be set to point to a new Value
// object that corresponds to the values represented in the string. The
- // caller takes ownership of the returned Value objects.
- bool Deserialize(Value** root);
+ // caller takes ownership of the returned Value objects. Otherwise, the root
+ // value will be changed and if |error_message| is non-null, it will contain
+ // a string describing the error.
+ bool Deserialize(Value** root, std::string* error_message);
void set_pretty_print(bool new_value) { pretty_print_ = new_value; }
bool pretty_print() { return pretty_print_; }
@@ -86,8 +88,10 @@ class JSONFileValueSerializer : public ValueSerializer {
// in to the constructor into a structure of Value objects. If the return
// value is true, the |root| parameter will be set to point to a new Value
// object that corresponds to the values represented in the file. The
- // caller takes ownership of the returned Value objects.
- bool Deserialize(Value** root);
+ // caller takes ownership of the returned Value objects. Otherwise, the root
+ // value will be changed and if |error_message| is non-null, it will contain
+ // a string describing the error.
+ bool Deserialize(Value** root, std::string* error_message);
private:
std::wstring json_file_path_;