From c6ccbee6c2993707112ff6bf330e1e8b9cf2e43c Mon Sep 17 00:00:00 2001 From: Aaron J Todd Date: Wed, 20 Oct 2021 14:56:31 -0400 Subject: [PATCH] fix(codegen): use wrapped response when deserializing modeled exceptions --- .../aws/sdk/kotlin/codegen/customization/s3/S3Generator.kt | 2 +- .../codegen/protocols/core/AwsHttpBindingProtocolGenerator.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/codegen/smithy-aws-kotlin-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/customization/s3/S3Generator.kt b/codegen/smithy-aws-kotlin-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/customization/s3/S3Generator.kt index 9e188bc6466..4b687ef7307 100644 --- a/codegen/smithy-aws-kotlin-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/customization/s3/S3Generator.kt +++ b/codegen/smithy-aws-kotlin-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/customization/s3/S3Generator.kt @@ -114,7 +114,7 @@ class S3Generator : RestXml() { } writer.write("") - .write("val modeledException = modeledExceptionDeserializer.deserialize(context, response)") + .write("val modeledException = modeledExceptionDeserializer.deserialize(context, wrappedResponse)") .write("#T(modeledException, wrappedResponse, errorDetails)", setS3ErrorMetadata) .write("throw modeledException") } diff --git a/codegen/smithy-aws-kotlin-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/protocols/core/AwsHttpBindingProtocolGenerator.kt b/codegen/smithy-aws-kotlin-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/protocols/core/AwsHttpBindingProtocolGenerator.kt index db2e947ec9a..8cf0067c709 100644 --- a/codegen/smithy-aws-kotlin-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/protocols/core/AwsHttpBindingProtocolGenerator.kt +++ b/codegen/smithy-aws-kotlin-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/protocols/core/AwsHttpBindingProtocolGenerator.kt @@ -155,7 +155,7 @@ abstract class AwsHttpBindingProtocolGenerator : HttpBindingProtocolGenerator() } writer.write("") - .write("val modeledException = modeledExceptionDeserializer.deserialize(context, response)") + .write("val modeledException = modeledExceptionDeserializer.deserialize(context, wrappedResponse)") .write("#T(modeledException, wrappedResponse, errorDetails)", AwsRuntimeTypes.Http.setAseErrorMetadata) .write("throw modeledException") }