"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
Return error on not found from ListFn
Brandur3b1e0b66bbf7
diff --git a/fs/lister.go b/fs/lister.goindex c9daf5838..a9fe4011e 100644--- a/fs/lister.go+++ b/fs/lister.go@@ -20,6 +20,7 @@ type Lister struct {finished sync.Oncelevel intfilter *Filter+ err error}// NewLister creates a Lister object.@@ -154,6 +155,14 @@ func (o *Lister) AddDir(dir *Dir) (abort bool) {return false}+// Error returns a globally application error that's been set on the Lister+// object.+func (o *Lister) Error() error {+ o.mu.RLock()+ defer o.mu.RUnlock()+ return o.err+}+// IncludeDirectory returns whether this directory should be// included in the listing (and recursed into or not).func (o *Lister) IncludeDirectory(remote string) bool {@@ -168,11 +177,12 @@ func (o *Lister) IncludeDirectory(remote string) bool {// Multiple goroutines can set the error state concurrently,// but only the first will be returned to the caller.func (o *Lister) SetError(err error) {- o.mu.RLock()+ o.mu.Lock()if err != nil && !o.abort {+ o.err = erro.results <- listerResult{Err: err}}- o.mu.RUnlock()+ o.mu.Unlock()o.Finished()}diff --git a/fs/operations.go b/fs/operations.goindex 985420a01..bade42513 100644--- a/fs/operations.go+++ b/fs/operations.go@@ -654,7 +654,10 @@ func ListFn(f Fs, fn func(Object)) error {for {o, err := list.GetObject()if err != nil {- log.Fatal(err)+ // The error will be persisted within the Lister object and+ // we'll get an opportunity to return it as we leave this+ // function.+ return}// check if we are finishedif o == nil {@@ -667,7 +670,7 @@ func ListFn(f Fs, fn func(Object)) error {}()}wg.Wait()- return nil+ return list.Error()}// mutex for synchronized output