BadRequestException
extends HttpException
in package
Thrown on `400 Bad Request` - the call was malformed, or the chat, message, or file it named does not exist. Check {@see HttpException::getMigrateToChatId()}: a group that has been upgraded to a supergroup reports the new id here.
Tags
Table of Contents
Methods
- __construct() : mixed
- fromResponse() : self
- Builds the most specific exception class for a Bot API error response.
- getErrorCode() : int
- The Bot API `error_code`, which mirrors the HTTP status.
- getMigrateToChatId() : ?int
- The supergroup the request should be retried against, set when a group chat has been upgraded and the old `chat_id` no longer resolves.
- getParameters() : array<string, mixed>
- The `parameters` object from the error envelope.
- getResponse() : ?ResponseInterface
- The raw response, when the failure came back over HTTP at all.
- getRetryAfter() : ?int
- Seconds to wait before repeating the request, when Telegram said so.
Methods
__construct()
public
__construct(string $message[, int $errorCode = 0 ][, ?ResponseInterface $response = null ][, array<string, mixed> $parameters = [] ][, ?Throwable $previous = null ]) : mixed
Parameters
- $message : string
- $errorCode : int = 0
- $response : ?ResponseInterface = null
- $parameters : array<string, mixed> = []
-
The
parametersobject from the error envelope. - $previous : ?Throwable = null
fromResponse()
Builds the most specific exception class for a Bot API error response.
public
static fromResponse(ResponseInterface $response[, array<string, mixed>|null $decoded = null ]) : self
Parameters
- $response : ResponseInterface
- $decoded : array<string, mixed>|null = null
-
The decoded body, when it parsed as JSON.
Return values
selfgetErrorCode()
The Bot API `error_code`, which mirrors the HTTP status.
public
getErrorCode() : int
Return values
intgetMigrateToChatId()
The supergroup the request should be retried against, set when a group chat has been upgraded and the old `chat_id` no longer resolves.
public
getMigrateToChatId() : ?int
Return values
?intgetParameters()
The `parameters` object from the error envelope.
public
getParameters() : array<string, mixed>
Return values
array<string, mixed>getResponse()
The raw response, when the failure came back over HTTP at all.
public
getResponse() : ?ResponseInterface
Return values
?ResponseInterfacegetRetryAfter()
Seconds to wait before repeating the request, when Telegram said so.
public
getRetryAfter() : ?int