From 214bbfd29a3d56257f081f96d31c0b364e660fc3 Mon Sep 17 00:00:00 2001 From: Ian Botsford <83236726+ianbotsf@users.noreply.github.com> Date: Mon, 4 Mar 2024 14:55:45 -0800 Subject: [PATCH] Revert "feat: enhance exception messages with request IDs and metadata (#1240)" This reverts commit 9c90cc65b1690d40772a414890108b98386440aa. --- .../8571dd20-b6a8-4cab-9e2a-567e273a016f.json | 8 -------- .../de403702-531d-4f43-bc33-aa5bc2fc000f.json | 8 -------- .../s3/S3ErrorMetadataIntegration.kt | 12 ++---------- gradle/libs.versions.toml | 4 ++-- .../GetBucketLocationOperationDeserializerTest.kt | 2 +- .../s3/internal/Handle200ErrorsInterceptorTest.kt | 15 ++++++--------- 6 files changed, 11 insertions(+), 38 deletions(-) delete mode 100644 .changes/8571dd20-b6a8-4cab-9e2a-567e273a016f.json delete mode 100644 .changes/de403702-531d-4f43-bc33-aa5bc2fc000f.json diff --git a/.changes/8571dd20-b6a8-4cab-9e2a-567e273a016f.json b/.changes/8571dd20-b6a8-4cab-9e2a-567e273a016f.json deleted file mode 100644 index 66bb19be561..00000000000 --- a/.changes/8571dd20-b6a8-4cab-9e2a-567e273a016f.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "id": "8571dd20-b6a8-4cab-9e2a-567e273a016f", - "type": "feature", - "description": "Add request IDs to exception messages where available", - "issues": [ - "awslabs/aws-sdk-kotlin#1212" - ] -} \ No newline at end of file diff --git a/.changes/de403702-531d-4f43-bc33-aa5bc2fc000f.json b/.changes/de403702-531d-4f43-bc33-aa5bc2fc000f.json deleted file mode 100644 index 9be9250e2c0..00000000000 --- a/.changes/de403702-531d-4f43-bc33-aa5bc2fc000f.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "id": "de403702-531d-4f43-bc33-aa5bc2fc000f", - "type": "feature", - "description": "Add error metadata to ServiceException messages when a service-provided message isn't available", - "issues": [ - "awslabs/aws-sdk-kotlin#1212" - ] -} diff --git a/codegen/aws-sdk-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/customization/s3/S3ErrorMetadataIntegration.kt b/codegen/aws-sdk-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/customization/s3/S3ErrorMetadataIntegration.kt index d9e80a59f30..cde0f078d26 100644 --- a/codegen/aws-sdk-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/customization/s3/S3ErrorMetadataIntegration.kt +++ b/codegen/aws-sdk-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/customization/s3/S3ErrorMetadataIntegration.kt @@ -48,16 +48,8 @@ class S3ErrorMetadataIntegration : KotlinIntegration { } } - // SectionWriter to override the default sdkErrorMetadata and displayMetadata for S3's version + // SectionWriter to override the default sdkErrorMetadata for S3's version private val addSdkErrorMetadataWriter = AppendingSectionWriter { writer -> - writer - .write("override val sdkErrorMetadata: S3ErrorMetadata = S3ErrorMetadata()") - .write("") - .withBlock("override val displayMetadata: List", "") { - withBlock("get() =", "") { - write("super.displayMetadata + ") - write("""listOfNotNull(sdkErrorMetadata.requestId2?.let { "Extended request ID: ${'$'}it" })""") - } - } + writer.write("override val sdkErrorMetadata: S3ErrorMetadata = S3ErrorMetadata()") } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 5a16019fc1b..f19bf376040 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -9,8 +9,8 @@ coroutines-version = "1.7.3" atomicfu-version = "0.23.1" # smithy-kotlin codegen and runtime are versioned separately -smithy-kotlin-runtime-version = "1.0.17-SNAPSHOT" -smithy-kotlin-codegen-version = "0.30.18-SNAPSHOT" +smithy-kotlin-runtime-version = "1.0.16" +smithy-kotlin-codegen-version = "0.30.17" # codegen smithy-version = "1.42.0" diff --git a/services/s3/common/test/aws/sdk/kotlin/services/s3/internal/GetBucketLocationOperationDeserializerTest.kt b/services/s3/common/test/aws/sdk/kotlin/services/s3/internal/GetBucketLocationOperationDeserializerTest.kt index 4d48f09a656..2d8cff75d01 100644 --- a/services/s3/common/test/aws/sdk/kotlin/services/s3/internal/GetBucketLocationOperationDeserializerTest.kt +++ b/services/s3/common/test/aws/sdk/kotlin/services/s3/internal/GetBucketLocationOperationDeserializerTest.kt @@ -67,6 +67,6 @@ class GetBucketLocationOperationDeserializerTest { } } - assertEquals("Some message, Request ID: Some request ID", exception.message) + assertEquals("Some message", exception.message) } } diff --git a/services/s3/common/test/aws/sdk/kotlin/services/s3/internal/Handle200ErrorsInterceptorTest.kt b/services/s3/common/test/aws/sdk/kotlin/services/s3/internal/Handle200ErrorsInterceptorTest.kt index a5541b6ab59..2fb82260a37 100644 --- a/services/s3/common/test/aws/sdk/kotlin/services/s3/internal/Handle200ErrorsInterceptorTest.kt +++ b/services/s3/common/test/aws/sdk/kotlin/services/s3/internal/Handle200ErrorsInterceptorTest.kt @@ -20,9 +20,6 @@ import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertFailsWith -private const val REQUEST_ID = "K2H6N7ZGQT6WHCEG" -private const val EXT_REQUEST_ID = "WWoZlnK4pTjKCYn6eNV7GgOurabfqLkjbSyqTvDMGBaI9uwzyNhSaDhOCPs8paFGye7S6b/AB3A=" - class Handle200ErrorsInterceptorTest { object TestCredentialsProvider : CredentialsProvider { @@ -32,8 +29,8 @@ class Handle200ErrorsInterceptorTest { SlowDown Please reduce your request rate. - $REQUEST_ID - $EXT_REQUEST_ID + K2H6N7ZGQT6WHCEG + WWoZlnK4pTjKCYn6eNV7GgOurabfqLkjbSyqTvDMGBaI9uwzyNhSaDhOCPs8paFGye7S6b/AB3A= """.trimIndent().encodeToByteArray() @@ -56,9 +53,9 @@ class Handle200ErrorsInterceptorTest { val expectedMessage = "Please reduce your request rate." assertEquals("SlowDown", ex.sdkErrorMetadata.errorCode) assertEquals(expectedMessage, ex.sdkErrorMetadata.errorMessage) - assertEquals("$expectedMessage, Request ID: $REQUEST_ID, Extended request ID: $EXT_REQUEST_ID", ex.message) - assertEquals(REQUEST_ID, ex.sdkErrorMetadata.requestId) - assertEquals(EXT_REQUEST_ID, ex.sdkErrorMetadata.requestId2) + assertEquals(expectedMessage, ex.message) + assertEquals("K2H6N7ZGQT6WHCEG", ex.sdkErrorMetadata.requestId) + assertEquals("WWoZlnK4pTjKCYn6eNV7GgOurabfqLkjbSyqTvDMGBaI9uwzyNhSaDhOCPs8paFGye7S6b/AB3A=", ex.sdkErrorMetadata.requestId2) } @Test @@ -110,7 +107,7 @@ class Handle200ErrorsInterceptorTest { s3.deleteObjects { bucket = "test" } } val expectedMessage = "Please use less foos." - assertEquals("$expectedMessage, Request ID: rid, Extended request ID: rid2", ex.message) + assertEquals(expectedMessage, ex.message) assertEquals(expectedMessage, ex.sdkErrorMetadata.errorMessage) assertEquals("FooError", ex.sdkErrorMetadata.errorCode) assertEquals("rid", ex.sdkErrorMetadata.requestId)