Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "feat: enhance exception messages with request IDs and metadata" #1244

Merged
merged 1 commit into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions .changes/8571dd20-b6a8-4cab-9e2a-567e273a016f.json

This file was deleted.

8 changes: 0 additions & 8 deletions .changes/de403702-531d-4f43-bc33-aa5bc2fc000f.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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<String>", "") {
withBlock("get() =", "") {
write("super.displayMetadata + ")
write("""listOfNotNull(sdkErrorMetadata.requestId2?.let { "Extended request ID: ${'$'}it" })""")
}
}
writer.write("override val sdkErrorMetadata: S3ErrorMetadata = S3ErrorMetadata()")
}
}
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,6 @@ class GetBucketLocationOperationDeserializerTest {
}
}

assertEquals("Some message, Request ID: Some request ID", exception.message)
assertEquals("Some message", exception.message)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -32,8 +29,8 @@ class Handle200ErrorsInterceptorTest {
<Error>
<Code>SlowDown</Code>
<Message>Please reduce your request rate.</Message>
<RequestId>$REQUEST_ID</RequestId>
<HostId>$EXT_REQUEST_ID</HostId>
<RequestId>K2H6N7ZGQT6WHCEG</RequestId>
<HostId>WWoZlnK4pTjKCYn6eNV7GgOurabfqLkjbSyqTvDMGBaI9uwzyNhSaDhOCPs8paFGye7S6b/AB3A=</HostId>
</Error>
""".trimIndent().encodeToByteArray()

Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down
Loading