add customheader err measure

This commit is contained in:
xing 2024-04-05 11:53:44 +08:00
parent 3c3ed73971
commit a0c6e48e83

View File

@ -12,6 +12,7 @@ import (
str "github.com/fthvgb1/wp-go/helper/strings" str "github.com/fthvgb1/wp-go/helper/strings"
"github.com/fthvgb1/wp-go/model" "github.com/fthvgb1/wp-go/model"
"regexp" "regexp"
"strings"
) )
func (h *Handle) DisplayHeaderText() bool { func (h *Handle) DisplayHeaderText() bool {
@ -23,7 +24,7 @@ var GetCustomHeaderImgFn = reload.BuildValFnWithConfirm("headerImages", customHe
func customHeadImag(h *Handle) ([]models.PostThumbnail, bool) { func customHeadImag(h *Handle) ([]models.PostThumbnail, bool) {
hs, err := h.GetHeaderImages(h.theme) hs, err := h.GetHeaderImages(h.theme)
if err != nil { if err != nil {
h.SetErr(err) h.SetErr(fmt.Errorf("get customheadimage err: %v", err))
return nil, false return nil, false
} }
return hs, true return hs, true
@ -33,7 +34,7 @@ func (h *Handle) GetCustomHeaderImg() (r models.PostThumbnail, isRand bool) {
var err error var err error
img := GetCustomHeaderImgFn(h) img := GetCustomHeaderImgFn(h)
err = h.Err() err = h.Err()
if err != nil { if err != nil && strings.Contains(err.Error(), "get customheadimage err") {
logs.Error(err, "获取页眉背景图失败") logs.Error(err, "获取页眉背景图失败")
return return
} }