Commit a56af241 authored by cduvall@chromium.org's avatar cduvall@chromium.org

Extensions Docs Server: Uniform handling of file not found errors

All the FileSystem implementations now handle missing files the same way (by
throwing a FileNotFoundError).

BUG=141664

Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=151078

Review URL: https://chromiumcodereview.appspot.com/10830252

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@151319 0039d316-1c4b-4281-b951-d872f2087c98
parent 54cc5396
...@@ -98,6 +98,5 @@ class APIDataSource(object): ...@@ -98,6 +98,5 @@ class APIDataSource(object):
return self._GenerateHandlebarContext(key, return self._GenerateHandlebarContext(key,
self._idl_cache.GetFromFile(self._base_path + '/' + idl_path), self._idl_cache.GetFromFile(self._base_path + '/' + idl_path),
path) path)
except FileNotFoundError as e: except FileNotFoundError:
logging.error(e)
raise raise
...@@ -62,5 +62,4 @@ class APIListDataSource(object): ...@@ -62,5 +62,4 @@ class APIListDataSource(object):
try: try:
return self._cache.GetFromFileListing(self._api_path)[key] return self._cache.GetFromFileListing(self._api_path)[key]
except FileNotFoundError as e: except FileNotFoundError as e:
logging.error(e) raise ValueError(str(e) + ': Error listing files for "%s".' % key)
return None
...@@ -303,7 +303,7 @@ def _MoveSingleFile(source_dir, ...@@ -303,7 +303,7 @@ def _MoveSingleFile(source_dir,
static_data is not None) static_data is not None)
static_file = os.path.join(intros_dest, processed_name + '.html') static_file = os.path.join(intros_dest, processed_name + '.html')
else: else:
template_data = _MakeArticleTemplate(unix_name, path) template_data = _MakeArticleTemplate(processed_name, path)
static_file = os.path.join(articles_dest, processed_name + '.html') static_file = os.path.join(articles_dest, processed_name + '.html')
if replace or not os.path.exists(template_file): if replace or not os.path.exists(template_file):
_WriteFile(template_file, template_data) _WriteFile(template_file, template_data)
......
...@@ -82,5 +82,4 @@ class IntroDataSource(object): ...@@ -82,5 +82,4 @@ class IntroDataSource(object):
return self._cache.GetFromFile(base_path + '/' + real_path) return self._cache.GetFromFile(base_path + '/' + real_path)
except FileNotFoundError as error: except FileNotFoundError as error:
pass pass
logging.error(error) raise ValueError(str(error) + ': No intro found for "%s".' % key)
return None
{{+partials.standard_apps_article article:intros.content_security_policy}} {{+partials.standard_apps_article article:intros.contentSecurityPolicy}}
\ No newline at end of file \ No newline at end of file
{{+partials.standard_apps_article article:intros.experimental_context_menus}} {{+partials.standard_apps_article article:intros.experimental_contextMenus}}
\ No newline at end of file \ No newline at end of file
{{+partials.standard_apps_article article:intros.experimental_devtools_inspected_window}} {{+partials.standard_apps_article article:intros.experimental_devtools_inspectedWindow}}
\ No newline at end of file \ No newline at end of file
{{+partials.standard_apps_article article:intros.experimental_input_ui}} {{+partials.standard_apps_article article:intros.experimental_inputUI}}
\ No newline at end of file \ No newline at end of file
{{+partials.standard_apps_article article:intros.experimental_web_inspector}} {{+partials.standard_apps_article article:intros.experimental_webInspector}}
\ No newline at end of file \ No newline at end of file
{{+partials.standard_apps_article article:intros.experimental_web_inspector_audits}} {{+partials.standard_apps_article article:intros.experimental_webInspector_audits}}
\ No newline at end of file \ No newline at end of file
{{+partials.standard_apps_article article:intros.experimental_web_inspector_panels}} {{+partials.standard_apps_article article:intros.experimental_webInspector_panels}}
\ No newline at end of file \ No newline at end of file
{{+partials.standard_apps_article article:intros.experimental_web_inspector_resources}} {{+partials.standard_apps_article article:intros.experimental_webInspector_resources}}
\ No newline at end of file \ No newline at end of file
{{+partials.standard_apps_article article:intros.manifest_version}} {{+partials.standard_apps_article article:intros.manifestVersion}}
\ No newline at end of file \ No newline at end of file
{{+partials.standard_apps_article article:intros.sandboxing_eval}} {{+partials.standard_apps_article article:intros.sandboxingEval}}
\ No newline at end of file \ No newline at end of file
{{+partials.standard_extensions_article article:intros.content_security_policy}} {{+partials.standard_extensions_article article:intros.contentSecurityPolicy}}
\ No newline at end of file \ No newline at end of file
{{+partials.standard_extensions_article article:intros.experimental_browsing_data}} {{+partials.standard_extensions_article article:intros.experimental_browsingData}}
\ No newline at end of file \ No newline at end of file
{{+partials.standard_extensions_article article:intros.experimental_content_settings}} {{+partials.standard_extensions_article article:intros.experimental_contentSettings}}
\ No newline at end of file \ No newline at end of file
{{+partials.standard_extensions_article article:intros.experimental_context_menus}} {{+partials.standard_extensions_article article:intros.experimental_contextMenus}}
\ No newline at end of file \ No newline at end of file
{{+partials.standard_extensions_article article:intros.experimental_devtools_inspected_window}} {{+partials.standard_extensions_article article:intros.experimental_devtools_inspectedWindow}}
\ No newline at end of file \ No newline at end of file
{{+partials.standard_extensions_article article:intros.experimental_input_ui}} {{+partials.standard_extensions_article article:intros.experimental_inputUI}}
\ No newline at end of file \ No newline at end of file
{{+partials.standard_extensions_article article:intros.experimental_web_inspector}} {{+partials.standard_extensions_article article:intros.experimental_webInspector}}
\ No newline at end of file \ No newline at end of file
{{+partials.standard_extensions_article article:intros.experimental_web_inspector_audits}} {{+partials.standard_extensions_article article:intros.experimental_webInspector_audits}}
\ No newline at end of file \ No newline at end of file
{{+partials.standard_extensions_article article:intros.experimental_web_inspector_panels}} {{+partials.standard_extensions_article article:intros.experimental_webInspector_panels}}
\ No newline at end of file \ No newline at end of file
{{+partials.standard_extensions_article article:intros.experimental_web_inspector_resources}} {{+partials.standard_extensions_article article:intros.experimental_webInspector_resources}}
\ No newline at end of file \ No newline at end of file
{{+partials.standard_extensions_article article:intros.experimental_web_request}} {{+partials.standard_extensions_article article:intros.experimental_webRequest}}
\ No newline at end of file \ No newline at end of file
{{+partials.standard_extensions_article article:intros.manifest_version}} {{+partials.standard_extensions_article article:intros.manifestVersion}}
\ No newline at end of file \ No newline at end of file
{{+partials.standard_extensions_article article:intros.sandboxing_eval}} {{+partials.standard_extensions_article article:intros.sandboxingEval}}
\ No newline at end of file \ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment