fix: error formatting

This commit is contained in:
yusing 2025-05-14 20:34:41 +08:00
parent 023cbc81bc
commit 8b3e058885
3 changed files with 7 additions and 5 deletions

View file

@ -1,7 +1,6 @@
package acl package acl
import ( import (
"errors"
"net" "net"
"strings" "strings"
@ -37,9 +36,9 @@ var errMatcherFormat = gperr.Multiline().AddLines(
) )
var ( var (
errSyntax = errors.New("syntax error") errSyntax = gperr.New("syntax error")
errInvalidIP = errors.New("invalid IP") errInvalidIP = gperr.New("invalid IP")
errInvalidCIDR = errors.New("invalid CIDR") errInvalidCIDR = gperr.New("invalid CIDR")
) )
func (matcher *Matcher) Parse(s string) error { func (matcher *Matcher) Parse(s string) error {

View file

@ -136,6 +136,9 @@ func (err *withSubject) MarshalJSON() ([]byte, error) {
Subjects: subjects, Subjects: subjects,
Err: err.Err, Err: err.Err,
} }
if err.pendingSubject != "" {
reversed.Subjects = append(reversed.Subjects, err.pendingSubject)
}
return json.Marshal(reversed) return json.Marshal(reversed)
} }

View file

@ -35,7 +35,7 @@ type (
} }
) )
var ErrNegativeInterval = errors.New("negative interval") var ErrNegativeInterval = gperr.New("negative interval")
func NewMonitor(r routes.Route) health.HealthMonCheck { func NewMonitor(r routes.Route) health.HealthMonCheck {
var mon health.HealthMonCheck var mon health.HealthMonCheck