1
mirror of https://github.com/rclone/rclone synced 2024-11-11 09:30:44 +01:00

vfs: Make error messages more informative #2009

This commit is contained in:
Nick Craig-Wood 2018-01-25 09:51:43 +00:00
parent 6f6f2aa369
commit dbabb18b0c

View File

@ -280,7 +280,7 @@ func (fh *WriteFileHandle) Truncate(size int64) (err error) {
return ECLOSED return ECLOSED
} }
if size != fh.offset { if size != fh.offset {
fs.Errorf(fh.remote, "WriteFileHandle: Truncate: Can't change size without cache") fs.Errorf(fh.remote, "WriteFileHandle: Truncate: Can't change size without --vfs-cache-mode >= writes")
return EPERM return EPERM
} }
// File is correct size // File is correct size
@ -292,7 +292,7 @@ func (fh *WriteFileHandle) Truncate(size int64) (err error) {
// Read reads up to len(p) bytes into p. // Read reads up to len(p) bytes into p.
func (fh *WriteFileHandle) Read(p []byte) (n int, err error) { func (fh *WriteFileHandle) Read(p []byte) (n int, err error) {
fs.Errorf(fh.remote, "WriteFileHandle: Read: Can't read and write to file without cache") fs.Errorf(fh.remote, "WriteFileHandle: Read: Can't read and write to file without --vfs-cache-mode >= minimal")
return 0, EPERM return 0, EPERM
} }
@ -300,7 +300,7 @@ func (fh *WriteFileHandle) Read(p []byte) (n int, err error) {
// underlying input source. It returns the number of bytes read (0 <= // underlying input source. It returns the number of bytes read (0 <=
// n <= len(p)) and any error encountered. // n <= len(p)) and any error encountered.
func (fh *WriteFileHandle) ReadAt(p []byte, off int64) (n int, err error) { func (fh *WriteFileHandle) ReadAt(p []byte, off int64) (n int, err error) {
fs.Errorf(fh.remote, "WriteFileHandle: ReadAt: Can't read and write to file without cache") fs.Errorf(fh.remote, "WriteFileHandle: ReadAt: Can't read and write to file without --vfs-cache-mode >= minimal")
return 0, EPERM return 0, EPERM
} }