autocert: use new OCSP error type (#4437)

This commit is contained in:
Kenneth Jenkins 2023-08-04 14:41:25 -07:00 committed by GitHub
parent 9d4d31cb4f
commit 0affd9268b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View file

@ -1,8 +1,9 @@
package autocert
import (
"strings"
"errors"
"github.com/caddyserver/certmagic"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
@ -32,7 +33,7 @@ func (c certMagicLoggerCore) Check(e zapcore.Entry, ce *zapcore.CheckedEntry) *z
func (c certMagicLoggerCore) Write(e zapcore.Entry, fs []zapcore.Field) error {
fs = append(c.fields, fs...)
for _, f := range fs {
if f.Type == zapcore.ErrorType && strings.Contains(f.Interface.(error).Error(), "no OCSP server specified in certificate") {
if f.Type == zapcore.ErrorType && errors.Is(f.Interface.(error), certmagic.ErrNoOCSPServerSpecified) {
// ignore this error message (#4245)
return nil
}