diff options
author | Thomas Waldmann <tw@waldmann-edv.de> | 2015-02-27 18:40:11 +0100 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2015-03-22 14:17:50 +0200 |
commit | 911960b32185e030cf2f0e0cd15fc3aaee388191 (patch) | |
tree | 749cee95cadd3dca28680eec87a3415c1ecaf44b | |
parent | bece5d28349ac226713537bef07f85af65b96a26 (diff) | |
download | obnam-911960b32185e030cf2f0e0cd15fc3aaee388191.tar.gz |
Add an ObnamError subclass for error
-rw-r--r-- | obnamlib/vfs_local.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/obnamlib/vfs_local.py b/obnamlib/vfs_local.py index 92d2b173..8462df22 100644 --- a/obnamlib/vfs_local.py +++ b/obnamlib/vfs_local.py @@ -37,6 +37,11 @@ class MallocError(obnamlib.ObnamError): msg = 'malloc out of memory while calling {function}' +class RootIsNotADirectory(obnamlib.ObnamError): + + msg = '{baserurl} is not a directory, but a VFS root must be a directory' + + class LocalFSFile(file): def read(self, amount=-1): @@ -94,7 +99,7 @@ class LocalFS(obnamlib.VirtualFileSystem): self.cwd = os.path.abspath(baseurl) if os.path.exists(self.cwd): # pragma: no cover if not os.path.isdir(self.cwd): - raise obnamlib.Error('%s is not a directory' % baseurl) + raise RootIsNotADirectory(baseurl=baseurl) if not self.isdir('.'): if create: tracing.trace('creating %s', baseurl) |