-
Notifications
You must be signed in to change notification settings - Fork 55
Closed
Labels
bugThis issue is a bug.This issue is a bug.
Milestone
Description
Describe the bug
When an operation deserializer encounters an unmodeled error it throws a generic service exception (e.g. S3Exception rather than NoSuchBucketException) it does not populate sdkErrorMetadata
Expected Behavior
sdkErrorMetadata should be populated with protocol response, requestId, and other such metadata available from the response.
Current Behavior
All of the metadata is missing.
Steps to Reproduce
See #448 which demonstrates the issue and shows that in particular our documentation for debugging will not work:
} catch (ex: AwsServiceException) {
val httpResp = ex.sdkErrorMetadata.protocolResponse as? HttpResponse
// Always null
if (httpResp != null) {
println(httpResp.headers)
println(httpResp.body.readAll()?.decodeToString())
}
throw ex
}Possible Solution
private suspend fun throwListObjectsError(context: ExecutionContext, response: HttpResponse): kotlin.Nothing {
...
val modeledExceptionDeserializer = when(errorDetails.code) {
"NoSuchBucket" -> NoSuchBucketDeserializer()
else -> throw S3Exception(errorDetails.message) // this needs to also call `setS3ErrorMetadata` before being thrown
}
val modeledException = modeledExceptionDeserializer.deserialize(context, wrappedResponse)
setS3ErrorMetadata(modeledException, wrappedResponse, errorDetails)
throw modeledException
}Context
Your Environment
- AWS Kotlin SDK version used:
0.9.3-alpha - Platform (JVM/JS/Native): JVM
- Operating System and version: MacOS 10.15.7
Metadata
Metadata
Assignees
Labels
bugThis issue is a bug.This issue is a bug.