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

Unified Diff: tools/json_schema_compiler/code.py

Issue 9309044: Supporting more APIs with json_schema_compiler (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: support for choices Created 8 years, 10 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: tools/json_schema_compiler/code.py
diff --git a/tools/json_schema_compiler/code.py b/tools/json_schema_compiler/code.py
index 4f2a64b014c8ad56a7da64d7a6d1919027986eb2..c19029a1ef0a2b3ba5135cbfc57dd9b12b0d08cb 100644
--- a/tools/json_schema_compiler/code.py
+++ b/tools/json_schema_compiler/code.py
@@ -35,11 +35,14 @@ class Code(object):
isolate any strings that haven't been substituted.
"""
if not isinstance(obj, Code):
- raise TypeError()
+ raise TypeError(type(obj))
assert self is not obj
for line in obj._code:
- # line % () will fail if any substitution tokens are left in line
- self._code.append(((' ' * self._indent_level) + line % ()).rstrip())
+ try:
+ # line % () will fail if any substitution tokens are left in line
+ self._code.append(((' ' * self._indent_level) + line % ()).rstrip())
+ except TypeError:
+ raise TypeError('Unsubstituted value when concatting\n' + line)
return self

Powered by Google App Engine
This is Rietveld 408576698