mount: map more rclone errors into file systems errors

This improves the error reporting, in particular for
fs.ErrorPermissionDenied which was being reported as an IO error.
This commit is contained in:
Nick Craig-Wood 2020-04-21 16:31:43 +01:00
parent eed9c5738d
commit 3f654dac37
3 changed files with 12 additions and 12 deletions

View File

@ -538,11 +538,11 @@ func translateError(err error) (errc int) {
switch errors.Cause(err) {
case vfs.OK:
return 0
case vfs.ENOENT:
case vfs.ENOENT, fs.ErrorDirNotFound, fs.ErrorObjectNotFound:
return -fuse.ENOENT
case vfs.EEXIST:
case vfs.EEXIST, fs.ErrorDirExists:
return -fuse.EEXIST
case vfs.EPERM:
case vfs.EPERM, fs.ErrorPermissionDenied:
return -fuse.EPERM
case vfs.ECLOSED:
return -fuse.EBADF
@ -554,7 +554,7 @@ func translateError(err error) (errc int) {
return -fuse.EBADF
case vfs.EROFS:
return -fuse.EROFS
case vfs.ENOSYS:
case vfs.ENOSYS, fs.ErrorNotImplemented:
return -fuse.ENOSYS
case vfs.EINVAL:
return -fuse.EINVAL

View File

@ -77,11 +77,11 @@ func translateError(err error) error {
switch errors.Cause(err) {
case vfs.OK:
return nil
case vfs.ENOENT:
case vfs.ENOENT, fs.ErrorDirNotFound, fs.ErrorObjectNotFound:
return fuse.ENOENT
case vfs.EEXIST:
case vfs.EEXIST, fs.ErrorDirExists:
return fuse.EEXIST
case vfs.EPERM:
case vfs.EPERM, fs.ErrorPermissionDenied:
return fuse.EPERM
case vfs.ECLOSED:
return fuse.Errno(syscall.EBADF)
@ -93,7 +93,7 @@ func translateError(err error) error {
return fuse.Errno(syscall.EBADF)
case vfs.EROFS:
return fuse.Errno(syscall.EROFS)
case vfs.ENOSYS:
case vfs.ENOSYS, fs.ErrorNotImplemented:
return fuse.ENOSYS
case vfs.EINVAL:
return fuse.Errno(syscall.EINVAL)

View File

@ -105,11 +105,11 @@ func translateError(err error) syscall.Errno {
switch errors.Cause(err) {
case vfs.OK:
return 0
case vfs.ENOENT:
case vfs.ENOENT, fs.ErrorDirNotFound, fs.ErrorObjectNotFound:
return syscall.ENOENT
case vfs.EEXIST:
case vfs.EEXIST, fs.ErrorDirExists:
return syscall.EEXIST
case vfs.EPERM:
case vfs.EPERM, fs.ErrorPermissionDenied:
return syscall.EPERM
case vfs.ECLOSED:
return syscall.EBADF
@ -121,7 +121,7 @@ func translateError(err error) syscall.Errno {
return syscall.EBADF
case vfs.EROFS:
return syscall.EROFS
case vfs.ENOSYS:
case vfs.ENOSYS, fs.ErrorNotImplemented:
return syscall.ENOSYS
case vfs.EINVAL:
return syscall.EINVAL