summaryrefslogtreecommitdiff
path: root/fs/errors.py
diff options
context:
space:
mode:
authorrfkelly0 <rfkelly0@67cdc799-7952-0410-af00-57a81ceafa0f>2009-09-18 04:30:23 +0000
committerrfkelly0 <rfkelly0@67cdc799-7952-0410-af00-57a81ceafa0f>2009-09-18 04:30:23 +0000
commit1dfc4c0ace2e6dc89642b16e850edc7cfa5f90c6 (patch)
treeed17cacb3b27120372b60a7eaeeef451ce7ceb74 /fs/errors.py
parent36a6fafa827faa314f0ac431cf83e165a4d8c1e6 (diff)
downloadpyfilesystem-git-1dfc4c0ace2e6dc89642b16e850edc7cfa5f90c6.tar.gz
make error classes pickleable, and add appropriate tests
Diffstat (limited to 'fs/errors.py')
-rw-r--r--fs/errors.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/errors.py b/fs/errors.py
index a96b985..6637391 100644
--- a/fs/errors.py
+++ b/fs/errors.py
@@ -37,12 +37,15 @@ class FSError(Exception):
def __unicode__(self):
return unicode(str(self))
+ def __getstate__(self):
+ return self.__dict__.copy()
+
class PathError(FSError):
"""Exception for errors to do with a path string."""
default_message = "Path is invalid: %(path)s"
- def __init__(self,path,**kwds):
+ def __init__(self,path="",**kwds):
self.path = path
super(PathError,self).__init__(**kwds)
@@ -51,7 +54,7 @@ class OperationFailedError(FSError):
"""Base exception class for errors associated with a specific operation."""
default_message = "Unable to %(opname)s: unspecified error [%(errno)s - %(details)s]"
- def __init__(self,opname,path=None,**kwds):
+ def __init__(self,opname="",path=None,**kwds):
self.opname = opname
self.path = path
self.errno = getattr(kwds.get("details",None),"errno",None)
@@ -82,7 +85,7 @@ class ResourceError(FSError):
"""Base exception class for error associated with a specific resource."""
default_message = "Unspecified resource error: %(path)s"
- def __init__(self,path,**kwds):
+ def __init__(self,path="",**kwds):
self.path = path
self.opname = kwds.pop("opname",None)
super(ResourceError,self).__init__(**kwds)