Skip to content

Commit 61755df

Browse files
Merge pull request #34 from Binnn-MX/add_minio_errors
Add MinIO compatibility errors
2 parents b6a6a19 + cdb010d commit 61755df

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

generated/src/aws-cpp-sdk-s3/source/S3Errors.cpp

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,18 @@ static const int NO_SUCH_KEY_HASH = HashingUtils::HashString("NoSuchKey");
3939
static const int OBJECT_NOT_IN_ACTIVE_TIER_HASH = HashingUtils::HashString("ObjectNotInActiveTierError");
4040
static const int BUCKET_ALREADY_EXISTS_HASH = HashingUtils::HashString("BucketAlreadyExists");
4141
static const int INVALID_OBJECT_STATE_HASH = HashingUtils::HashString("InvalidObjectState");
42+
// MinIO compatibility error hashes (all MinIO errors handled here for S3 compatibility)
43+
static const int MINIO_INTERNAL_ERROR_HASH = HashingUtils::HashString("InternalError");
44+
static const int MINIO_SERVER_NOT_INITIALIZED_HASH = HashingUtils::HashString("XMinioServerNotInitialized");
45+
static const int MINIO_IAM_NOT_INITIALIZED_HASH = HashingUtils::HashString("XMinioIAMNotInitialized");
46+
static const int MINIO_BUCKET_METADATA_NOT_INITIALIZED_HASH = HashingUtils::HashString("XMinioBucketMetadataNotInitialized");
47+
static const int MINIO_SERVER_BUSY_HASH = HashingUtils::HashString("ServerBusy");
48+
static const int MINIO_TOO_MANY_REQUESTS_HASH = HashingUtils::HashString("TooManyRequests");
49+
static const int MINIO_SLOW_DOWN_READ_HASH = HashingUtils::HashString("SlowDownRead");
50+
static const int MINIO_SLOW_DOWN_WRITE_HASH = HashingUtils::HashString("SlowDownWrite");
51+
static const int MINIO_REQUEST_TIME_TOO_SKEWED_HASH = HashingUtils::HashString("RequestTimeTooSkewed");
52+
static const int MINIO_REQUEST_TIMEOUT_HASH = HashingUtils::HashString("RequestTimeout");
53+
static const int MINIO_CLIENT_DISCONNECTED_HASH = HashingUtils::HashString("ClientDisconnected");
4254

4355

4456
AWSError<CoreErrors> GetErrorForName(const char* errorName)
@@ -97,6 +109,35 @@ AWSError<CoreErrors> GetErrorForName(const char* errorName)
97109
{
98110
return AWSError<CoreErrors>(static_cast<CoreErrors>(S3Errors::INVALID_OBJECT_STATE), RetryableType::NOT_RETRYABLE);
99111
}
112+
// MinIO compatibility error mappings (all MinIO errors handled in S3ErrorMapper for priority)
113+
else if (hashCode == MINIO_INTERNAL_ERROR_HASH)
114+
{
115+
return AWSError<CoreErrors>(static_cast<CoreErrors>(S3Errors::INTERNAL_FAILURE), RetryableType::RETRYABLE);
116+
}
117+
else if (hashCode == MINIO_SERVER_NOT_INITIALIZED_HASH ||
118+
hashCode == MINIO_IAM_NOT_INITIALIZED_HASH ||
119+
hashCode == MINIO_BUCKET_METADATA_NOT_INITIALIZED_HASH ||
120+
hashCode == MINIO_SERVER_BUSY_HASH ||
121+
hashCode == MINIO_CLIENT_DISCONNECTED_HASH)
122+
{
123+
return AWSError<CoreErrors>(static_cast<CoreErrors>(S3Errors::SERVICE_UNAVAILABLE), RetryableType::RETRYABLE);
124+
}
125+
else if (hashCode == MINIO_TOO_MANY_REQUESTS_HASH)
126+
{
127+
return AWSError<CoreErrors>(static_cast<CoreErrors>(S3Errors::THROTTLING), RetryableType::RETRYABLE);
128+
}
129+
else if (hashCode == MINIO_SLOW_DOWN_READ_HASH || hashCode == MINIO_SLOW_DOWN_WRITE_HASH)
130+
{
131+
return AWSError<CoreErrors>(static_cast<CoreErrors>(S3Errors::SLOW_DOWN), RetryableType::RETRYABLE);
132+
}
133+
else if (hashCode == MINIO_REQUEST_TIME_TOO_SKEWED_HASH)
134+
{
135+
return AWSError<CoreErrors>(static_cast<CoreErrors>(S3Errors::REQUEST_TIME_TOO_SKEWED), RetryableType::RETRYABLE);
136+
}
137+
else if (hashCode == MINIO_REQUEST_TIMEOUT_HASH)
138+
{
139+
return AWSError<CoreErrors>(static_cast<CoreErrors>(S3Errors::REQUEST_TIMEOUT), RetryableType::RETRYABLE);
140+
}
100141
return AWSError<CoreErrors>(CoreErrors::UNKNOWN, false);
101142
}
102143

0 commit comments

Comments
 (0)