If one of our commands failed to return a meaningful
return code, exit with EX_GENERAL.
If one of our commands raised a retryable exception (e.g. try again
later), capture that and don't traceback. This will cut down on the
number of bug reports for "try again later" responses.
Clearly report non-specific S3Error, S3Exception, and related failures
with a traceback.
... | ... |
@@ -2405,6 +2405,8 @@ def main(): |
2405 | 2405 |
|
2406 | 2406 |
try: |
2407 | 2407 |
rc = cmd_func(args) |
2408 |
+ if rc is None: # if we missed any cmd_*() returns |
|
2409 |
+ rc = EX_GENERAL |
|
2408 | 2410 |
return rc |
2409 | 2411 |
except S3Error, e: |
2410 | 2412 |
error(u"S3 error: %s" % e) |
... | ... |
@@ -2491,11 +2493,16 @@ if __name__ == '__main__': |
2491 | 2491 |
report_exception(e) |
2492 | 2492 |
sys.exit(EX_GENERAL) |
2493 | 2493 |
|
2494 |
- except ParameterError, e: |
|
2494 |
+ except (ParameterError, InvalidFileError), e: |
|
2495 | 2495 |
error(u"Parameter problem: %s" % e) |
2496 | 2496 |
sys.exit(EX_USAGE) |
2497 | 2497 |
|
2498 |
- except S3Error, e: |
|
2498 |
+ except (S3DownloadError, S3UploadError, S3RequestError), e: |
|
2499 |
+ error(u"S3 Temporary Error: %s. Please try again later." % e) |
|
2500 |
+ sys.exit(EX_TEMPFAIL) |
|
2501 |
+ |
|
2502 |
+ except (S3Error, S3Exception, S3ResponseError, CloudFrontError), e: |
|
2503 |
+ report_exception(e) |
|
2499 | 2504 |
sys.exit(EX_SOFTWARE) |
2500 | 2505 |
|
2501 | 2506 |
except SystemExit, e: |