Use error type internals
@@ -44,9 +44,7 @@ func (a AbstractAcClient) GetTokenResponse(ctx context.Context, callbackURL *url
redirectURIVal, err := content.GetContextAttribute(ctx, a.clientConfig.HCLBody(), lib.RedirectURI)
if redirectURIVal == "" {
- return nil, errors.Oauth2.Messagef("%s is required", lib.RedirectURI)
- } else if err != nil {
- return nil, errors.Oauth2.With(err)
+ return nil, errors.Oauth2.With(err).Messagef("%s is required", lib.RedirectURI)
}
absoluteURL, err := lib.AbsoluteURL(redirectURIVal, eval.NewRawOrigin(callbackURL))
@@ -62,9 +60,7 @@ func (a AbstractAcClient) GetTokenResponse(ctx context.Context, callbackURL *url
verifierVal, err := content.GetContextAttribute(ctx, a.clientConfig.HCLBody(), "verifier_value")
verifierValue := strings.TrimSpace(verifierVal)
if verifierValue == "" {
- return nil, errors.Oauth2.Messagef("Empty verifier_value")
- } else if err != nil {
- return nil, errors.Oauth2.With(err)
+ return nil, errors.Oauth2.With(err).Messagef("Empty verifier_value")
}
verifierMethod, err := getVerifierMethod(ctx, a.asConfig)
