{{- /*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 }}
