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

Unified Diff: components/policy/resources/PRESUBMIT.py

Issue 257583005: Fix crashes in components/policy/resources/PRESUBMIT.py. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@policy-list-doc
Patch Set: Move try/catch as suggested. Created 6 years, 8 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
« no previous file with comments | « no previous file | components/policy/tools/syntax_check_policy_template_json.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/policy/resources/PRESUBMIT.py
diff --git a/components/policy/resources/PRESUBMIT.py b/components/policy/resources/PRESUBMIT.py
index 3870875aa379667a0dc5c6d59e95347b8e3934b3..e34e1acfd49cb448154ce5c0ea6dd484fcc2cbe2 100644
--- a/components/policy/resources/PRESUBMIT.py
+++ b/components/policy/resources/PRESUBMIT.py
@@ -105,7 +105,11 @@ def _CommonChecks(input_api, output_api):
template_path = os_path.join(local_path, 'policy_templates.json')
affected_files = input_api.AffectedFiles()
if any(f.AbsoluteLocalPath() == template_path for f in affected_files):
- policies = _GetPolicyTemplates(template_path)
+ try:
+ policies = _GetPolicyTemplates(template_path)
+ except:
+ results.append(output_api.PresubmitError('Invalid Python/JSON syntax.'))
+ return results
results.extend(_CheckPolicyTestCases(input_api, output_api, policies))
results.extend(_CheckPolicyHistograms(input_api, output_api, policies))
« no previous file with comments | « no previous file | components/policy/tools/syntax_check_policy_template_json.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698