diff options
author | rfkelly0 <rfkelly0@67cdc799-7952-0410-af00-57a81ceafa0f> | 2009-06-15 12:09:53 +0000 |
---|---|---|
committer | rfkelly0 <rfkelly0@67cdc799-7952-0410-af00-57a81ceafa0f> | 2009-06-15 12:09:53 +0000 |
commit | ec53eb2267d4e68bb6946910524537fa1f987a5e (patch) | |
tree | 1c5d6f514ea98a2ee0f9d7d3cf883580da758384 /fs/zipfs.py | |
parent | 72ee6ff392bdacd4784be346a80537aa77af812f (diff) | |
download | pyfilesystem-ec53eb2267d4e68bb6946910524537fa1f987a5e.tar.gz |
some error-handling simplifications
git-svn-id: http://pyfilesystem.googlecode.com/svn/branches/rfk-ideas@170 67cdc799-7952-0410-af00-57a81ceafa0f
Diffstat (limited to 'fs/zipfs.py')
-rw-r--r-- | fs/zipfs.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/zipfs.py b/fs/zipfs.py index 3da4da4..2d1bdec 100644 --- a/fs/zipfs.py +++ b/fs/zipfs.py @@ -74,7 +74,7 @@ class ZipFS(FS): try: self.zf = ZipFile(zip_file, mode, compression_type, allowZip64) except IOError: - raise FileNotFoundError(str(zip_file), msg="Zip file does not exist: %(path)s") + raise ResourceNotFoundError(str(zip_file), msg="Zip file does not exist: %(path)s") self.zip_path = str(zip_file) self.temp_fs = None @@ -132,7 +132,7 @@ class ZipFS(FS): try: contents = self.zf.read(path) except KeyError: - raise FileNotFoundError(path) + raise ResourceNotFoundError(path) return StringIO(contents) if 'w' in mode: @@ -153,12 +153,12 @@ class ZipFS(FS): self._lock.acquire() try: if not self.exists(path): - raise FileNotFoundError(path) + raise ResourceNotFoundError(path) path = normpath(path) try: contents = self.zf.read(path) except KeyError: - raise FileNotFoundError(path) + raise ResourceNotFoundError(path) except RuntimeError: raise OperationFailedError("read file", path=path, msg="Zip file must be oppened with 'r' or 'a' to read") return contents |