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

View file

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

View file

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