Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions raw_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ func (b *Bot) rawRequest(ctx context.Context, method string, params any, dest an

if !r.OK {
switch r.ErrorCode {
case 403:
case http.StatusForbidden:
return fmt.Errorf("%w, %s", ErrorForbidden, r.Description)
case 400:
case http.StatusBadRequest:
if r.Parameters.MigrateToChatID != 0 {
err := &MigrateError{
Message: fmt.Sprintf("%s: %s", ErrorBadRequest, r.Description),
Expand All @@ -114,13 +114,13 @@ func (b *Bot) rawRequest(ctx context.Context, method string, params any, dest an
return err
}
return fmt.Errorf("%w, %s", ErrorBadRequest, r.Description)
case 401:
case http.StatusUnauthorized:
return fmt.Errorf("%w, %s", ErrorUnauthorized, r.Description)
case 404:
case http.StatusNotFound:
return fmt.Errorf("%w, %s", ErrorNotFound, r.Description)
case 409:
case http.StatusConflict:
return fmt.Errorf("%w, %s", ErrorConflict, r.Description)
case 429:
case http.StatusTooManyRequests:
err := &TooManyRequestsError{
Message: fmt.Sprintf("%s, %s", ErrorTooManyRequests, r.Description),
RetryAfter: r.Parameters.RetryAfter,
Expand Down
Loading