From d73759fcf1b1c3b4724b9b9c329d2b126749524d Mon Sep 17 00:00:00 2001 From: Luc Talatinian Date: Wed, 18 Sep 2024 15:49:44 -0400 Subject: [PATCH] refactor exception.type value --- aws/retry/middleware.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/aws/retry/middleware.go b/aws/retry/middleware.go index 624928c18c2..286892adc80 100644 --- a/aws/retry/middleware.go +++ b/aws/retry/middleware.go @@ -10,10 +10,10 @@ import ( privatemetrics "github.com/aws/aws-sdk-go-v2/aws/middleware/private/metrics" internalcontext "github.com/aws/aws-sdk-go-v2/internal/context" + "github.com/aws/smithy-go" "github.com/aws/aws-sdk-go-v2/aws" awsmiddle "github.com/aws/aws-sdk-go-v2/aws/middleware" - awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" "github.com/aws/aws-sdk-go-v2/internal/sdk" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/metrics" @@ -415,12 +415,12 @@ func AddRetryMiddlewares(stack *smithymiddle.Stack, options AddRetryMiddlewaresO return nil } -// deduces the modeled exception type from an attempt error, which is almost -// always wrapped +// Determines the value of exception.type for metrics purposes. We prefer an +// API-specific error code, otherwise it's just the Go type for the value. func errorType(err error) string { - var terr *awshttp.ResponseError + var terr smithy.APIError if errors.As(err, &terr) { - return fmt.Sprintf("%T", terr.Err) + return terr.ErrorCode() } return fmt.Sprintf("%T", err) }