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

Unified Diff: chrome/common/extensions/docs/server2/compiled_file_system.py

Issue 12996003: Dynamically generate a heading for Extension Docs API pages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moving logic into availability_data_source Created 7 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
Index: chrome/common/extensions/docs/server2/compiled_file_system.py
diff --git a/chrome/common/extensions/docs/server2/compiled_file_system.py b/chrome/common/extensions/docs/server2/compiled_file_system.py
index 051572b130102728b49a61515fb91c7890738733..8fdc70345d98be15c4553500ea83b0300f2cc7ae 100644
--- a/chrome/common/extensions/docs/server2/compiled_file_system.py
+++ b/chrome/common/extensions/docs/server2/compiled_file_system.py
@@ -2,6 +2,8 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import logging
+
class _CacheEntry(object):
def __init__(self, cache_data, version):
self._cache_data = cache_data
@@ -92,11 +94,17 @@ class CompiledFileSystem(object):
cache_entry = self._file_object_store.Get(path, time=0).Get()
if (cache_entry is not None) and (version == cache_entry.version):
return cache_entry._cache_data
- cache_data = self._populate_function(
- path,
- self._file_system.ReadSingle(path, binary=binary))
- self._file_object_store.Set(path, _CacheEntry(cache_data, version), time=0)
- return cache_data
+ try:
+ cache_data = self._populate_function(
+ path,
+ self._file_system.ReadSingle(path, binary=binary))
+ self._file_object_store.Set(path,
+ _CacheEntry(cache_data, version),
+ time=0)
+ return cache_data
+ except ValueError as e:
+ logging.error('Could not get data for the file at %s: %s' % (path, e))
+ return None
def GetFromFileListing(self, path):
"""Calls |populate_function| on the listing of the files at |path|.

Powered by Google App Engine
This is Rietveld 408576698