From 1d6f2bcab9d4d5fc4827ed1a601ed781e38aaa9f Mon Sep 17 00:00:00 2001 From: Andreas Kohn Date: Fri, 27 Oct 2023 19:42:12 +0200 Subject: [PATCH] Retain the error stack if `checkIfCertShouldBeObtained` returns an error This allows a outside caller of `GetCertificate` to use `errors.As` to check for their own response, and react accordingly. --- handshake.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handshake.go b/handshake.go index a91d3ebb..d430426f 100644 --- a/handshake.go +++ b/handshake.go @@ -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(ctx, 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.