Skip to content

Commit

Permalink
refactor exception.type value (#2796)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucix-aws committed Sep 18, 2024
1 parent 9d618e9 commit aeed036
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 aeed036

Please sign in to comment.