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

cmd: make exit code 8 for --max-transfer exceeded

Nick Craig-Wood21383877df3c
diff --git a/cmd/cmd.go b/cmd/cmd.go
index 6a6a51f62..396803594 100644
--- a/cmd/cmd.go
+++ b/cmd/cmd.go
@@ -62,6 +62,7 @@ const (
exitCodeRetryError
exitCodeNoRetryError
exitCodeFatalError
+ exitCodeTransferExceeded
)
// Root is the main rclone command
@@ -461,15 +462,17 @@ func resolveExitCode(err error) {
os.Exit(exitCodeSuccess)
}
- err = errors.Cause(err)
+ _, unwrapped := fserrors.Cause(err)
switch {
- case err == fs.ErrorDirNotFound:
+ case unwrapped == fs.ErrorDirNotFound:
os.Exit(exitCodeDirNotFound)
- case err == fs.ErrorObjectNotFound:
+ case unwrapped == fs.ErrorObjectNotFound:
os.Exit(exitCodeFileNotFound)
- case err == errorUncategorized:
+ case unwrapped == errorUncategorized:
os.Exit(exitCodeUncategorizedError)
+ case unwrapped == accounting.ErrorMaxTransferLimitReached:
+ os.Exit(exitCodeTransferExceeded)
case fserrors.ShouldRetry(err):
os.Exit(exitCodeRetryError)
case fserrors.IsNoRetryError(err):
diff --git a/docs/content/docs.md b/docs/content/docs.md
index 2489c9cda..2b4338d6a 100644
--- a/docs/content/docs.md
+++ b/docs/content/docs.md
@@ -543,6 +543,8 @@ Defaults to off.
When the limit is reached all transfers will stop immediately.
+Rclone will exit with exit code 8 if the transfer limit is reached.
+
### --modify-window=TIME ###
When checking whether a file has been modified, this is the maximum
@@ -1097,6 +1099,7 @@ it will log a high priority message if the retry was successful.
* `5` - Temporary error (one that more retries might fix) (Retry errors)
* `6` - Less serious errors (like 461 errors from dropbox) (NoRetry errors)
* `7` - Fatal error (one that more retries won't fix, like account suspended) (Fatal errors)
+ * `8` - Transfer exceeded - limit set by --max-transfer reached
Environment Variables
---------------------