Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

Make sure wrapped retry/fatal errors are never nil to avoid panic

Nick Craig-Wood808380457511
diff --git a/fs/error.go b/fs/error.go
index 5b91f9a25..dc826501a 100644
--- a/fs/error.go
+++ b/fs/error.go
@@ -58,6 +58,9 @@ var _ Retrier = wrappedRetryError{(error)(nil)}
// RetryError makes an error which indicates it would like to be retried
func RetryError(err error) error {
+ if err == nil {
+ err = errors.New("needs retry")
+ }
return wrappedRetryError{err}
}
@@ -100,6 +103,9 @@ var _ Fataler = wrappedFatalError{(error)(nil)}
// FatalError makes an error which indicates it is a fatal error and
// the sync should stop.
func FatalError(err error) error {
+ if err == nil {
+ err = errors.New("fatal error")
+ }
return wrappedFatalError{err}
}