Files
mautrix-telegram/pkg/gotd/gen/_template/errors.tmpl
T
2025-06-27 20:03:37 -07:00

22 lines
445 B
Cheetah

{{- /*gotype: go.mau.fi/mautrix-telegram/pkg/gotd/gen.config*/ -}}
{{ define "errors" }}
{{ $pkg := $.Package }}
{{ template "header" $ }}
// Telegram API error types.
const (
{{- range $s := $.Errors }}
Err{{ $s.Name }} = "{{ $s.Type }}"
{{- end }}
)
{{- range $s := $.Errors }}
// Is{{ $s.Name }} reports whether err is {{ $s.Type }}.
func Is{{ $s.Name }}(err error) bool {
return tgerr.Is(err, Err{{ $s.Name }})
}
{{ end }}
{{ end }}