package tgerr

Import Path
	github.com/gotd/td/tgerr (on go.dev)

Dependency Relation
	imports 8 packages, and imported by 6 packages

Involved Source Files Package tgerr implements helpers for error handling. flood_wait.go
Package-Level Type Names (total 4, in which 2 are exported)
/* sort exporteds by: | */
Error represents RPC error returned as result to request. // 3 // 420 // FLOOD_WAIT_3 // FLOOD_WAIT (*Error) Error() string IsCode reports whether error Code is equal to code. IsCodeOneOf returns true if error code is one of codes. IsOneOf returns true if error type is in tt. IsType reports whether error has type t. *Error : error func As(err error) (rpcErr *Error, ok bool) func AsType(err error, t string) (rpcErr *Error, ok bool) func New(code int, msg string) *Error
FloodWaitOption configures flood wait. func FloodWaitWithClock(c clock.Clock) FloodWaitOption func FloodWait(ctx context.Context, err error, opts ...FloodWaitOption) (bool, error)
Package-Level Functions (total 8, all are exported)
As extracts *Error from err if possible.
AsFloodWait returns wait duration and true boolean if err is the "FLOOD_WAIT" error. Client should wait for that duration before issuing new requests with same method.
AsType returns *Error from err if rpc error type is t.
FloodWait sleeps required duration and returns true if err is FLOOD_WAIT or false and context or original error otherwise.
FloodWaitWithClock sets time source for flood wait.
Is returns true if err type is t.
IsCode returns true of error code is as provided.
New creates new *Error from code and message, extracting argument and type.
Package-Level Constants (only one, which is exported)
ErrFloodWait is error type of "FLOOD_WAIT" error.