FILE / ScuroNeko/Laniakea

tgapi/errors.go

Исходный файл и его история в репозитории.
FILE 07ce1ccda07ffd2699401c8a9ca2b99f17436523
Files
Laniakea/tgapi/errors.go
T
ScuroNeko 5959d69945
Golang lint / lint (pull_request) Successful in 3m4s
Golang lint / lint (push) Successful in 3m8s
(fix): polling retry-after
(tests): polling rate-limit

(doc): changelog update
2026-05-08 14:11:58 +03:00

31 lines
830 B
Go

package tgapi
import (
"errors"
"fmt"
)
// ErrPoolUnexpected reports an unexpected result type returned from the worker pool.
var ErrPoolUnexpected = errors.New("unexpected response from pool")
// ErrPoolQueueFull reports that the internal request queue is full.
var ErrPoolQueueFull = errors.New("worker pool queue full")
// ErrPoolStopped reports that a request was submitted after the worker pool stopped.
var ErrPoolStopped = errors.New("worker pool stopped")
// ResponseError reports an unsuccessful Telegram API response.
type ResponseError struct {
Code int
Description string
Parameters *ResponseParameters
}
// Error returns the Telegram API error code and description.
func (e *ResponseError) Error() string {
if e == nil {
return "<nil>"
}
return fmt.Sprintf("[%d] %s", e.Code, e.Description)
}