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

Side by Side Diff: chrome/common/extensions/docs/server2/intro_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 from HTMLParser import HTMLParser 5 from HTMLParser import HTMLParser
6 import logging 6 import logging
7 import re 7 import re
8 8
9 from docs_server_utils import FormatKey 9 from docs_server_utils import FormatKey
10 from file_system import FileNotFoundError 10 from file_system import FileNotFoundError
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 return self.get(key) 75 return self.get(key)
76 76
77 def get(self, key): 77 def get(self, key):
78 real_path = FormatKey(key) 78 real_path = FormatKey(key)
79 error = None 79 error = None
80 for base_path in self._base_paths: 80 for base_path in self._base_paths:
81 try: 81 try:
82 return self._cache.GetFromFile(base_path + '/' + real_path) 82 return self._cache.GetFromFile(base_path + '/' + real_path)
83 except FileNotFoundError as error: 83 except FileNotFoundError as error:
84 pass 84 pass
85 logging.error(error) 85 raise ValueError(str(error) + ': No intro found for "%s".' % key)
86 return None
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698