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

Side by Side Diff: chrome/common/extensions/docs/server2/api_list_data_source.py

Issue 10830252: Extensions Docs Server: Uniform handling of file not found errors (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: better error handling/slight template fix to pass integration_test Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import logging 5 import logging
6 import os 6 import os
7 7
8 from file_system import FileNotFoundError 8 from file_system import FileNotFoundError
9 import third_party.json_schema_compiler.model as model 9 import third_party.json_schema_compiler.model as model
10 from docs_server_utils import SanitizeAPIName 10 from docs_server_utils import SanitizeAPIName
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 'extensions': self._GetAPIsInSubdirectory(api_names, 'extensions') 55 'extensions': self._GetAPIsInSubdirectory(api_names, 'extensions')
56 } 56 }
57 57
58 def __getitem__(self, key): 58 def __getitem__(self, key):
59 return self.get(key) 59 return self.get(key)
60 60
61 def get(self, key): 61 def get(self, key):
62 try: 62 try:
63 return self._cache.GetFromFileListing(self._api_path)[key] 63 return self._cache.GetFromFileListing(self._api_path)[key]
64 except FileNotFoundError as e: 64 except FileNotFoundError as e:
65 logging.error(e) 65 raise ValueError(str(e) + ': Error listing files for "%s".' % key)
66 return None
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/server2/api_data_source.py ('k') | chrome/common/extensions/docs/server2/converter.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698