aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/platform
diff options
context:
space:
mode:
authorGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-08-09 13:35:53 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-08-09 13:35:53 -0700
commit0fc611f218ef76eb4fd1b3116d6cb56f5c612104 (patch)
tree804e979bc51b1f631dcf41a15758f50a27a80979 /tensorflow/core/platform
parentee38f86972b13f3eb90032e93b305e822152bf62 (diff)
parentf8844f932d63a020f8ca44c012df2b26600df002 (diff)
Merge pull request #20077 from yongtang:06152018-s3-errors
PiperOrigin-RevId: 208101398
Diffstat (limited to 'tensorflow/core/platform')
-rw-r--r--tensorflow/core/platform/s3/s3_file_system.cc44
1 files changed, 15 insertions, 29 deletions
diff --git a/tensorflow/core/platform/s3/s3_file_system.cc b/tensorflow/core/platform/s3/s3_file_system.cc
index d5f5dec390..462113f9bb 100644
--- a/tensorflow/core/platform/s3/s3_file_system.cc
+++ b/tensorflow/core/platform/s3/s3_file_system.cc
@@ -26,7 +26,6 @@ limitations under the License.
#include <aws/core/utils/StringUtils.h>
#include <aws/core/utils/logging/AWSLogging.h>
#include <aws/core/utils/logging/LogSystemInterface.h>
-#include <aws/core/utils/StringUtils.h>
#include <aws/s3/S3Client.h>
#include <aws/s3/S3Errors.h>
#include <aws/s3/model/CopyObjectRequest.h>
@@ -254,10 +253,8 @@ class S3WritableFile : public WritableFile {
outfile_->clear();
outfile_->seekp(offset);
if (!putObjectOutcome.IsSuccess()) {
- string error = strings::StrCat(
- putObjectOutcome.GetError().GetExceptionName().c_str(), ": ",
- putObjectOutcome.GetError().GetMessage().c_str());
- return errors::Internal(error);
+ return errors::Unknown(putObjectOutcome.GetError().GetExceptionName(),
+ ": ", putObjectOutcome.GetError().GetMessage());
}
return Status::OK();
}
@@ -410,10 +407,8 @@ Status S3FileSystem::GetChildren(const string& dir,
auto listObjectsOutcome =
this->GetS3Client()->ListObjects(listObjectsRequest);
if (!listObjectsOutcome.IsSuccess()) {
- string error = strings::StrCat(
- listObjectsOutcome.GetError().GetExceptionName().c_str(), ": ",
- listObjectsOutcome.GetError().GetMessage().c_str());
- return errors::Internal(error);
+ return errors::Unknown(listObjectsOutcome.GetError().GetExceptionName(),
+ ": ", listObjectsOutcome.GetError().GetMessage());
}
listObjectsResult = listObjectsOutcome.GetResult();
@@ -447,10 +442,8 @@ Status S3FileSystem::Stat(const string& fname, FileStatistics* stats) {
headBucketRequest.WithBucket(bucket.c_str());
auto headBucketOutcome = this->GetS3Client()->HeadBucket(headBucketRequest);
if (!headBucketOutcome.IsSuccess()) {
- string error = strings::StrCat(
- headBucketOutcome.GetError().GetExceptionName().c_str(), ": ",
- headBucketOutcome.GetError().GetMessage().c_str());
- return errors::Internal(error);
+ return errors::Unknown(headBucketOutcome.GetError().GetExceptionName(),
+ ": ", headBucketOutcome.GetError().GetMessage());
}
stats->length = 0;
stats->is_directory = 1;
@@ -511,10 +504,8 @@ Status S3FileSystem::DeleteFile(const string& fname) {
auto deleteObjectOutcome =
this->GetS3Client()->DeleteObject(deleteObjectRequest);
if (!deleteObjectOutcome.IsSuccess()) {
- string error = strings::StrCat(
- deleteObjectOutcome.GetError().GetExceptionName().c_str(), ": ",
- deleteObjectOutcome.GetError().GetMessage().c_str());
- return errors::Internal(error);
+ return errors::Unknown(deleteObjectOutcome.GetError().GetExceptionName(),
+ ": ", deleteObjectOutcome.GetError().GetMessage());
}
return Status::OK();
}
@@ -612,10 +603,8 @@ Status S3FileSystem::RenameFile(const string& src, const string& target) {
auto listObjectsOutcome =
this->GetS3Client()->ListObjects(listObjectsRequest);
if (!listObjectsOutcome.IsSuccess()) {
- string error = strings::StrCat(
- listObjectsOutcome.GetError().GetExceptionName().c_str(), ": ",
- listObjectsOutcome.GetError().GetMessage().c_str());
- return errors::Internal(error);
+ return errors::Unknown(listObjectsOutcome.GetError().GetExceptionName(),
+ ": ", listObjectsOutcome.GetError().GetMessage());
}
listObjectsResult = listObjectsOutcome.GetResult();
@@ -633,10 +622,8 @@ Status S3FileSystem::RenameFile(const string& src, const string& target) {
auto copyObjectOutcome =
this->GetS3Client()->CopyObject(copyObjectRequest);
if (!copyObjectOutcome.IsSuccess()) {
- string error = strings::StrCat(
- copyObjectOutcome.GetError().GetExceptionName().c_str(), ": ",
- copyObjectOutcome.GetError().GetMessage().c_str());
- return errors::Internal(error);
+ return errors::Unknown(copyObjectOutcome.GetError().GetExceptionName(),
+ ": ", copyObjectOutcome.GetError().GetMessage());
}
deleteObjectRequest.SetBucket(src_bucket.c_str());
@@ -645,10 +632,9 @@ Status S3FileSystem::RenameFile(const string& src, const string& target) {
auto deleteObjectOutcome =
this->GetS3Client()->DeleteObject(deleteObjectRequest);
if (!deleteObjectOutcome.IsSuccess()) {
- string error = strings::StrCat(
- deleteObjectOutcome.GetError().GetExceptionName().c_str(), ": ",
- deleteObjectOutcome.GetError().GetMessage().c_str());
- return errors::Internal(error);
+ return errors::Unknown(
+ deleteObjectOutcome.GetError().GetExceptionName(), ": ",
+ deleteObjectOutcome.GetError().GetMessage());
}
}
listObjectsRequest.SetMarker(listObjectsResult.GetNextMarker());