Skip to content

Commit 9d4d824

Browse files
authored
fix: register middleware per operation (#268)
* Removes all error handling middleware and implements error matching/deserialization per/operation * Override protocol generation for S3 to use a generator customized to S3.
1 parent 79b14c2 commit 9d4d824

File tree

39 files changed

+451
-1443
lines changed

39 files changed

+451
-1443
lines changed

aws-runtime/protocols/aws-json-protocols/common/src/aws/sdk/kotlin/runtime/protocol/json/RestJsonError.kt

Lines changed: 0 additions & 29 deletions
This file was deleted.

aws-runtime/protocols/aws-json-protocols/common/src/aws/sdk/kotlin/runtime/protocol/json/RestJsonErrorDeserializer.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
*/
55
package aws.sdk.kotlin.runtime.protocol.json
66

7-
import aws.sdk.kotlin.runtime.http.middleware.errors.ErrorDetails
7+
import aws.sdk.kotlin.runtime.InternalSdkApi
8+
import aws.sdk.kotlin.runtime.http.ErrorDetails
89
import aws.smithy.kotlin.runtime.http.Headers
910
import aws.smithy.kotlin.runtime.serde.*
1011
import aws.smithy.kotlin.runtime.serde.json.JsonDeserializer
@@ -25,7 +26,8 @@ public const val X_AMZN_EVENT_ERROR_MESSAGE_HEADER_NAME: String = ":error-messag
2526
* - SDK Unmarshal Service API Errors (SEP)
2627
* - x-amzn-ErrorMessage (SEP)
2728
*/
28-
internal object RestJsonErrorDeserializer {
29+
@InternalSdkApi
30+
public object RestJsonErrorDeserializer {
2931
// alternative field descriptors for error codes embedded in the document
3032
private val ERR_CODE_ALT1_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("code"))
3133
private val ERR_CODE_ALT2_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("__type"))
@@ -43,7 +45,7 @@ internal object RestJsonErrorDeserializer {
4345
field(MESSAGE_ALT3_DESCRIPTOR)
4446
}
4547

46-
suspend fun deserialize(headers: Headers, payload: ByteArray?): ErrorDetails {
48+
public suspend fun deserialize(headers: Headers, payload: ByteArray?): ErrorDetails {
4749
var code: String? = headers[X_AMZN_ERROR_TYPE_HEADER_NAME]
4850
var message: String? = headers[X_AMZN_ERROR_MESSAGE_HEADER_NAME]
4951
if (message == null) {

aws-runtime/protocols/aws-json-protocols/common/test/aws/sdk/kotlin/runtime/protocol/json/RestJsonErrorTest.kt

Lines changed: 0 additions & 249 deletions
This file was deleted.

aws-runtime/protocols/aws-xml-protocols/common/src/aws/sdk/kotlin/runtime/protocol/xml/Ec2QueryErrorDeserializer.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
*/
55
package aws.sdk.kotlin.runtime.protocol.xml
66

7-
import aws.sdk.kotlin.runtime.http.middleware.errors.ErrorDetails
7+
import aws.sdk.kotlin.runtime.InternalSdkApi
8+
import aws.sdk.kotlin.runtime.http.ErrorDetails
89
import aws.smithy.kotlin.runtime.serde.*
910
import aws.smithy.kotlin.runtime.serde.xml.XmlCollectionName
1011
import aws.smithy.kotlin.runtime.serde.xml.XmlDeserializer
@@ -14,7 +15,8 @@ internal data class Ec2QueryErrorResponse(val errors: List<Ec2QueryError>, val r
1415

1516
internal data class Ec2QueryError(val code: String?, val message: String?)
1617

17-
internal suspend fun parseEc2QueryErrorResponse(payload: ByteArray): ErrorDetails {
18+
@InternalSdkApi
19+
public suspend fun parseEc2QueryErrorResponse(payload: ByteArray): ErrorDetails {
1820
val response = Ec2QueryErrorResponseDeserializer.deserialize(XmlDeserializer(payload, true))
1921
val firstError = response.errors.firstOrNull()
2022
return ErrorDetails(firstError?.code, firstError?.message, response.requestId)

aws-runtime/protocols/aws-xml-protocols/common/src/aws/sdk/kotlin/runtime/protocol/xml/Ec2QueryErrorHandling.kt

Lines changed: 0 additions & 30 deletions
This file was deleted.

aws-runtime/protocols/aws-xml-protocols/common/src/aws/sdk/kotlin/runtime/protocol/xml/RestXmlError.kt

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)