Skip to content

Commit aeed036

Browse files
committed
refactor exception.type value (#2796)
1 parent 9d618e9 commit aeed036

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

aws/retry/middleware.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import (
1010

1111
privatemetrics "github.com/aws/aws-sdk-go-v2/aws/middleware/private/metrics"
1212
internalcontext "github.com/aws/aws-sdk-go-v2/internal/context"
13+
"github.com/aws/smithy-go"
1314

1415
"github.com/aws/aws-sdk-go-v2/aws"
1516
awsmiddle "github.com/aws/aws-sdk-go-v2/aws/middleware"
16-
awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http"
1717
"github.com/aws/aws-sdk-go-v2/internal/sdk"
1818
"github.com/aws/smithy-go/logging"
1919
"github.com/aws/smithy-go/metrics"
@@ -415,12 +415,12 @@ func AddRetryMiddlewares(stack *smithymiddle.Stack, options AddRetryMiddlewaresO
415415
return nil
416416
}
417417

418-
// deduces the modeled exception type from an attempt error, which is almost
419-
// always wrapped
418+
// Determines the value of exception.type for metrics purposes. We prefer an
419+
// API-specific error code, otherwise it's just the Go type for the value.
420420
func errorType(err error) string {
421-
var terr *awshttp.ResponseError
421+
var terr smithy.APIError
422422
if errors.As(err, &terr) {
423-
return fmt.Sprintf("%T", terr.Err)
423+
return terr.ErrorCode()
424424
}
425425
return fmt.Sprintf("%T", err)
426426
}

0 commit comments

Comments
 (0)