Skip to content

Commit

Permalink
Retain the error stack if checkIfCertShouldBeObtained returns an error
Browse files Browse the repository at this point in the history
This allows a outside caller of `GetCertificate` to use `errors.As` to check for
their own response, and react accordingly.
  • Loading branch information
ankon committed Oct 27, 2023
1 parent 560847b commit d1d90df
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion handshake.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ func (cfg *Config) getCertDuringHandshake(ctx context.Context, hello *tls.Client
// make sense to try loading one from storage (issue #185), getting it from a
// certificate manager, or obtaining one from an issuer.
if err := cfg.checkIfCertShouldBeObtained(name, false); err != nil {
return Certificate{}, fmt.Errorf("certificate is not allowed for server name %s: %v", name, err)
return Certificate{}, fmt.Errorf("certificate is not allowed for server name %s: %w", name, err)
}

// If an external Manager is configured, try to get it from them.
Expand Down

0 comments on commit d1d90df

Please sign in to comment.