about summary refs log tree commit diff
path: root/src/libstore
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-06-19T16·15+0200
committerEelco Dolstra <edolstra@gmail.com>2017-06-19T16·51+0200
commitb33621d4253addc4a0cdf1fb7a4082109aaafa78 (patch)
treeb20c5b807582471d2adf10e752ec0f40216577ed /src/libstore
parent1c969611ba962a860744b2718fa6f989e7be5165 (diff)
Handle S3Errors::RESOURCE_NOT_FOUND from aws-sdk-cpp
This is returned by recent versions. Also handle NO_SUCH_KEY even
though the library doesn't actually return that at the moment.
Diffstat (limited to 'src/libstore')
-rw-r--r--src/libstore/s3-binary-cache-store.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libstore/s3-binary-cache-store.cc b/src/libstore/s3-binary-cache-store.cc
index f57227f024a7..8029cd8cca0c 100644
--- a/src/libstore/s3-binary-cache-store.cc
+++ b/src/libstore/s3-binary-cache-store.cc
@@ -233,8 +233,10 @@ struct S3BinaryCacheStoreImpl : public S3BinaryCacheStore
 
         if (!res.IsSuccess()) {
             auto & error = res.GetError();
-            if (error.GetErrorType() == Aws::S3::S3Errors::UNKNOWN // FIXME
-                && error.GetMessage().find("404") != std::string::npos)
+            if (error.GetErrorType() == Aws::S3::S3Errors::RESOURCE_NOT_FOUND
+                || error.GetErrorType() == Aws::S3::S3Errors::NO_SUCH_KEY
+                || (error.GetErrorType() == Aws::S3::S3Errors::UNKNOWN // FIXME
+                    && error.GetMessage().find("404") != std::string::npos))
                 return false;
             throw Error(format("AWS error fetching ‘%s’: %s") % path % error.GetMessage());
         }