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

This commit is contained in:
Nick Craig-Wood 2018-05-03 15:04:30 +01:00
parent f95835d613
commit 21383877df
2 changed files with 10 additions and 4 deletions

View file

@ -62,6 +62,7 @@ const (
exitCodeRetryError exitCodeRetryError
exitCodeNoRetryError exitCodeNoRetryError
exitCodeFatalError exitCodeFatalError
exitCodeTransferExceeded
) )
// Root is the main rclone command // Root is the main rclone command
@ -461,15 +462,17 @@ func resolveExitCode(err error) {
os.Exit(exitCodeSuccess) os.Exit(exitCodeSuccess)
} }
err = errors.Cause(err) _, unwrapped := fserrors.Cause(err)
switch { switch {
case err == fs.ErrorDirNotFound: case unwrapped == fs.ErrorDirNotFound:
os.Exit(exitCodeDirNotFound) os.Exit(exitCodeDirNotFound)
case err == fs.ErrorObjectNotFound: case unwrapped == fs.ErrorObjectNotFound:
os.Exit(exitCodeFileNotFound) os.Exit(exitCodeFileNotFound)
case err == errorUncategorized: case unwrapped == errorUncategorized:
os.Exit(exitCodeUncategorizedError) os.Exit(exitCodeUncategorizedError)
case unwrapped == accounting.ErrorMaxTransferLimitReached:
os.Exit(exitCodeTransferExceeded)
case fserrors.ShouldRetry(err): case fserrors.ShouldRetry(err):
os.Exit(exitCodeRetryError) os.Exit(exitCodeRetryError)
case fserrors.IsNoRetryError(err): case fserrors.IsNoRetryError(err):

View file

@ -543,6 +543,8 @@ Defaults to off.
When the limit is reached all transfers will stop immediately. 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 ### ### --modify-window=TIME ###
When checking whether a file has been modified, this is the maximum 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) * `5` - Temporary error (one that more retries might fix) (Retry errors)
* `6` - Less serious errors (like 461 errors from dropbox) (NoRetry 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) * `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 Environment Variables
--------------------- ---------------------