6cf6f95f58
CodeQL / Analyze (push) Has been cancelled
Sync to Gitee / Run (push) Has been cancelled
Go / build & test (1.25.x) (push) Has been cancelled
Go / build & test (1.26.x) (push) Has been cancelled
Lint / resolve module (push) Has been cancelled
Lint / lint module (push) Has been cancelled
18 lines
496 B
Smarty
18 lines
496 B
Smarty
{{ range .Errors }}
|
|
|
|
{{ if .HasComment }}{{ .Comment }}{{ end -}}
|
|
func Is{{.CamelValue}}(err error) bool {
|
|
if err == nil {
|
|
return false
|
|
}
|
|
e := errors.FromError(err)
|
|
return e.Reason == {{ .Name }}_{{ .Value }}.String() && e.Code == {{ .HTTPCode }}
|
|
}
|
|
|
|
{{ if .HasComment }}{{ .Comment }}{{ end -}}
|
|
func Error{{ .CamelValue }}(format string, args ...interface{}) *errors.Error {
|
|
return errors.New({{ .HTTPCode }}, {{ .Name }}_{{ .Value }}.String(), fmt.Sprintf(format, args...))
|
|
}
|
|
|
|
{{- end }}
|