card_id/common/errs/errors.go

27 lines
448 B
Go

package errs
import (
"fmt"
"strings"
)
func e(prefix string, f string, args ...any) error {
return fmt.Errorf("%s: "+f, prefix, args)
}
func Logic(f string, a ...any) error {
return e("logic", f, a)
}
func IsLogic(err error) bool {
return strings.HasPrefix("logic", err.Error())
}
func Invalid(f string, a ...any) error {
return e("invalid", f, a)
}
func IsInvalid(err error) bool {
return strings.HasPrefix("invalid", err.Error())
}