From a0c6e48e83a179f3b5255d258f9495ff6326a9f5 Mon Sep 17 00:00:00 2001 From: xing Date: Fri, 5 Apr 2024 11:53:44 +0800 Subject: [PATCH] add customheader err measure --- app/theme/wp/customheader.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/theme/wp/customheader.go b/app/theme/wp/customheader.go index 464673f..832adc4 100644 --- a/app/theme/wp/customheader.go +++ b/app/theme/wp/customheader.go @@ -12,6 +12,7 @@ import ( str "github.com/fthvgb1/wp-go/helper/strings" "github.com/fthvgb1/wp-go/model" "regexp" + "strings" ) func (h *Handle) DisplayHeaderText() bool { @@ -23,7 +24,7 @@ var GetCustomHeaderImgFn = reload.BuildValFnWithConfirm("headerImages", customHe func customHeadImag(h *Handle) ([]models.PostThumbnail, bool) { hs, err := h.GetHeaderImages(h.theme) if err != nil { - h.SetErr(err) + h.SetErr(fmt.Errorf("get customheadimage err: %v", err)) return nil, false } return hs, true @@ -33,7 +34,7 @@ func (h *Handle) GetCustomHeaderImg() (r models.PostThumbnail, isRand bool) { var err error img := GetCustomHeaderImgFn(h) err = h.Err() - if err != nil { + if err != nil && strings.Contains(err.Error(), "get customheadimage err") { logs.Error(err, "获取页眉背景图失败") return }