Exemple #1
0
 def _convert_error(self, f):
     if f.check(NoSuchChildError):
         childname = f.value.args[0].encode("utf-8")
         msg = "'%s' doesn't exist" % childname
         raise ftp.FileNotFoundError(msg)
     if f.check(ExistingChildError):
         msg = f.value.args[0].encode("utf-8")
         raise ftp.FileExistsError(msg)
     return f
Exemple #2
0
def vfsToFtpError(vfsError):
    """
    Map vfs errors to the corresponding ftp errors, if it exists.
    """
    if isinstance(vfsError, ivfs.NotFoundError):
        return defer.fail(ftp.FileNotFoundError(vfsError))
    elif isinstance(vfsError, ivfs.AlreadyExistsError):
        return defer.fail(ftp.FileExistsError(vfsError))
    return defer.fail(vfsError)