Skip to content

Commit

Permalink
refactor exception.type value
Browse files Browse the repository at this point in the history
  • Loading branch information
lucix-aws committed Sep 18, 2024
1 parent c141a21 commit d73759f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions aws/retry/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
}

0 comments on commit d73759f

Please sign in to comment.