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

Unified Diff: components/policy/core/common/schema_map.cc

Issue 139853013: Improve error message display for Schema::Validate() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@expand-policy-schema-3
Patch Set: fix comments Created 6 years, 11 months 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: components/policy/core/common/schema_map.cc
diff --git a/components/policy/core/common/schema_map.cc b/components/policy/core/common/schema_map.cc
index 4d64fdeba632bc928308ccac218d301475d347a4..90c30ee51cd4e66011fbafe961698c115ce44d8e 100644
--- a/components/policy/core/common/schema_map.cc
+++ b/components/policy/core/common/schema_map.cc
@@ -64,12 +64,17 @@ void SchemaMap::FilterBundle(PolicyBundle* bundle) const {
const base::Value* policy_value = it_map->second.value;
Schema policy_schema = schema->GetProperty(policy_name);
++it_map;
+ std::string error_path;
std::string error;
if (!policy_value ||
- !policy_schema.Validate(*policy_value, SCHEMA_STRICT, &error)) {
+ !policy_schema.Validate(*policy_value,
+ SCHEMA_STRICT,
+ &error_path,
+ &error)) {
LOG(ERROR) << "Dropping policy " << policy_name << " for "
<< it->first.component_id
- << " because it's not valid: " << error;
+ << " because it's not valid: " << error
+ << " at " << error_path;
map->Erase(policy_name);
}
}

Powered by Google App Engine
This is Rietveld 408576698