diff options
author | kalman@chromium.org <kalman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-13 15:34:14 +0000 |
---|---|---|
committer | kalman@chromium.org <kalman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-13 15:34:14 +0000 |
commit | 276a62e85cb2dac4e75a516ee91f929158b20b41 (patch) | |
tree | 7750832144d6cc7bf2298919a4161d0e7c4e34e3 /chrome/common/extensions/docs/server2/file_system.py | |
parent | 897d858c624f87285cbcc0847787212b5eea6860 (diff) | |
download | chromium_src-276a62e85cb2dac4e75a516ee91f929158b20b41.zip chromium_src-276a62e85cb2dac4e75a516ee91f929158b20b41.tar.gz chromium_src-276a62e85cb2dac4e75a516ee91f929158b20b41.tar.bz2 |
Docserver: introduce a file_system.FileSystemError class, in addition to the
file_system.FileNotFoundError. At the moment the two are conflated, leading to a
bug where svn.chromium.org fetch errors are interpreted as the file not being
found, meaning that files that should exist give 404s. They should just come
from datastore if there are fetch errors (that's partly why I added it).
R=jyasskin@chromium.org
NOTRY=true
Review URL: https://chromiumcodereview.appspot.com/23604045
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@223049 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/extensions/docs/server2/file_system.py')
-rw-r--r-- | chrome/common/extensions/docs/server2/file_system.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/chrome/common/extensions/docs/server2/file_system.py b/chrome/common/extensions/docs/server2/file_system.py index 7f2d6c5..1515bc7 100644 --- a/chrome/common/extensions/docs/server2/file_system.py +++ b/chrome/common/extensions/docs/server2/file_system.py @@ -3,6 +3,15 @@ # found in the LICENSE file. class FileNotFoundError(Exception): + '''Raised when a file isn't found for read or stat. + ''' + def __init__(self, filename): + Exception.__init__(self, filename) + +class FileSystemError(Exception): + '''Raised on when there are errors reading or statting files, such as a + network timeout. + ''' def __init__(self, filename): Exception.__init__(self, filename) @@ -48,6 +57,9 @@ class FileSystem(object): If binary=False, the contents of each file will be unicode parsed as utf-8, and failing that as latin-1 (some extension docs use latin-1). If binary=True then the contents will be a str. + + If any path cannot be found, raises a FileNotFoundError. + For any other failure, raises a FileSystemError. ''' raise NotImplementedError(self.__class__) @@ -61,6 +73,9 @@ class FileSystem(object): '''Returns a |StatInfo| object containing the version of |path|. If |path| is a directory, |StatInfo| will have the versions of all the children of the directory in |StatInfo.child_versions|. + + If the path cannot be found, raises a FileNotFoundError. + For any other failure, raises a FileSystemError. ''' raise NotImplementedError(self.__class__) @@ -76,6 +91,9 @@ class FileSystem(object): def Walk(self, root): '''Recursively walk the directories in a file system, starting with root. Emulates os.walk from the standard os module. + + If the root cannot be found, raises a FileNotFoundError. + For any other failure, raises a FileSystemError. ''' basepath = root.rstrip('/') + '/' |