mirror of
https://github.com/rclone/rclone.git
synced 2024-11-22 12:36:38 +08:00
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:
parent
eed9c5738d
commit
3f654dac37
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user