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
commit435964b453467bedb27b23989c48f27d305ca3d2 (patch)
treeed17cacb3b27120372b60a7eaeeef451ce7ceb74 /fs/errors.py
parentb9335c30974c29dd1c12b903c7243387e9c98e6a (diff)
downloadpyfilesystem-435964b453467bedb27b23989c48f27d305ca3d2.tar.gz
make error classes pickleable, and add appropriate tests
git-svn-id: http://pyfilesystem.googlecode.com/svn/trunk@252 67cdc799-7952-0410-af00-57a81ceafa0f
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)