summaryrefslogtreecommitdiffstats
path: root/chrome/common
diff options
context:
space:
mode:
authorskerner@chromium.org <skerner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-30 19:56:59 +0000
committerskerner@chromium.org <skerner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-30 19:56:59 +0000
commit7cba60c43caf11e5481fb3e488e8e6ffd9a9df0b (patch)
tree65593d99e7359d1779c140a1342a67155394364d /chrome/common
parentc4f7dfb44992c8fb9139133107e0ac9200edf241 (diff)
downloadchromium_src-7cba60c43caf11e5481fb3e488e8e6ffd9a9df0b.zip
chromium_src-7cba60c43caf11e5481fb3e488e8e6ffd9a9df0b.tar.gz
chromium_src-7cba60c43caf11e5481fb3e488e8e6ffd9a9df0b.tar.bz2
Improve error message in the extension api docs build script. When the json file used to build the html documentation is unreadable or has a syntax error, gives a clear error message.
BUG=18717 TEST=Manualy tested a missing input file and a file with a syntax error. Review URL: http://codereview.chromium.org/343052 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30620 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rwxr-xr-xchrome/common/extensions/docs/build/build.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/chrome/common/extensions/docs/build/build.py b/chrome/common/extensions/docs/build/build.py
index 18af04c..8d55ab1 100755
--- a/chrome/common/extensions/docs/build/build.py
+++ b/chrome/common/extensions/docs/build/build.py
@@ -130,9 +130,19 @@ def FindTestShell():
"To specify a path to test_shell use --test-shell-path")
def GetAPIModuleNames():
- contents = open(_extension_api_json, 'r').read();
- extension_api = json.loads(contents, encoding="ASCII")
- return set( module['namespace'].encode() for module in extension_api)
+ try:
+ contents = open(_extension_api_json, 'r').read()
+ except IOError, msg:
+ raise Exception("Failed to read the file that defines the extensions API. "
+ "The specific error was: %s." % msg)
+
+ try:
+ extension_api = json.loads(contents, encoding="ASCII")
+ except ValueError, msg:
+ raise Exception("File %s has a syntax error: %s" %
+ (_extension_api_json, msg))
+
+ return set(module['namespace'].encode() for module in extension_api)
def GetStaticFileNames():
static_files = os.listdir(_static_dir)