Skip to content

Commit 19671d2

Browse files
authored
Adds http response code to S3 error message (#2656)
For a lot of newer s3 error responses aws has decided to use the http response code to signal the type of the error rather than the `S3Errors` construct in the sdk.
1 parent 7ca3af7 commit 19671d2

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

cpp/arcticdb/storage/s3/detail-inl.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,9 @@ inline bool is_not_found_error(const Aws::S3::S3Errors& error) {
5757
auto type = err.GetErrorType();
5858

5959
auto error_message_suffix = fmt::format(
60-
"S3Error#{} {}: {} for object '{}'",
60+
"S3Error:{}, HttpResponseCode:{}, {}: {} for object '{}'",
6161
int(err.GetErrorType()),
62+
int(err.GetResponseCode()),
6263
err.GetExceptionName().c_str(),
6364
err.GetMessage().c_str(),
6465
object_name

python/tests/integration/arcticdb/test_s3.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ def test_s3_storage_failures(mock_s3_store_with_error_simulation):
4343
result_df = lib.read(symbol_success).data
4444
assert_frame_equal(result_df, df)
4545

46-
with pytest.raises(StorageException, match="Network error: S3Error#99"):
46+
with pytest.raises(StorageException, match="Network error: S3Error:99"):
4747
lib.write(symbol_fail_write, df)
4848

49-
with pytest.raises(StorageException, match="Unexpected error: S3Error#17"):
49+
with pytest.raises(StorageException, match="Unexpected error: S3Error:17"):
5050
lib.read(symbol_fail_read)
5151

5252

@@ -174,15 +174,15 @@ def test_wrapped_s3_storage(lib_name, wrapped_s3_storage_bucket):
174174
# Depending on the reload interval, the error might be different
175175
# Setting the reload interval to 0 will make the error be "StorageException"
176176
with config_context("VersionMap.ReloadInterval", 0):
177-
with pytest.raises(StorageException, match="Network error: S3Error#99"):
177+
with pytest.raises(StorageException, match="Network error: S3Error:99"):
178178
lib.read("s")
179179

180180
with config_context_string("S3ClientTestWrapper.FailureBucket", test_bucket_name):
181-
with pytest.raises(StorageException, match="Network error: S3Error#99"):
181+
with pytest.raises(StorageException, match="Network error: S3Error:99"):
182182
lib.write("s", data=create_df())
183183

184184
with config_context_string("S3ClientTestWrapper.FailureBucket", f"{test_bucket_name},non_existent_bucket"):
185-
with pytest.raises(StorageException, match="Network error: S3Error#99"):
185+
with pytest.raises(StorageException, match="Network error: S3Error:99"):
186186
lib.write("s", data=create_df())
187187

188188
# There should be no failures

0 commit comments

Comments
 (0)