YouTubePHP Documentation

RateLimitedException extends HttpException
in package

Too many requests, too quickly: Google's `rateLimitExceeded`, or a 429.

For live chat it means polling faster than the chat's pollingIntervalMillis, or posting faster than YouTube lets one account post. Http backs off and retries it a few times before giving up with this.

Tags
since
1.0.0
author

Valithor Obsidion valithor@valgorithms.com

Table of Contents

Methods

__construct()  : mixed
fromError()  : self
The exception an error body stands for, with or without the response it came in. A streamed call reports an error that arrives after its headers as one element of the stream, which has no status line of its own.
fromResponse()  : self
The exception an error response stands for.
getDomain()  : ?string
Google's error domain, e.g. `youtube.quota`, when it gave one.
getEndpoint()  : string
The API method called, e.g. `liveChatMessages.list`.
getErrors()  : array<int, array<string, mixed>>
getReason()  : ?string
Google's reason code, e.g. `quotaExceeded`, when it gave one.
getResponse()  : ?ResponseInterface
getRetryAfter()  : ?float
Seconds to wait before trying again, when the response said.
getStatus()  : int
The HTTP status, or 0 when there was no response.

Methods

__construct()

public __construct(string $message[, int $code = 0 ][, string|null $reason = null ][, string|null $domain = null ][, array<int, array<string, mixed>> $errors = [] ][, ?ResponseInterface $response = null ][, string $endpoint = '' ][, ?Throwable $previous = null ]) : mixed
Parameters
$message : string
$code : int = 0

The HTTP status, or 0 when there was no response.

$reason : string|null = null

Google's reason code, e.g. quotaExceeded.

$domain : string|null = null

Google's error domain, e.g. youtube.quota.

$errors : array<int, array<string, mixed>> = []

Every entry of the error's errors list.

$response : ?ResponseInterface = null
$endpoint : string = ''

The API method called, e.g. liveChatMessages.list.

$previous : ?Throwable = null

fromError()

The exception an error body stands for, with or without the response it came in. A streamed call reports an error that arrives after its headers as one element of the stream, which has no status line of its own.

public static fromError(array<string, mixed> $decoded, int $status, string $endpoint[, ?ResponseInterface $response = null ]) : self
Parameters
$decoded : array<string, mixed>

The decoded body: {"error": {...}}.

$status : int

The HTTP status; the error's own code is used when it has one.

$endpoint : string
$response : ?ResponseInterface = null
Return values
self

fromResponse()

The exception an error response stands for.

public static fromResponse(ResponseInterface $response, array<string, mixed>|null $decoded, string $endpoint) : self
Parameters
$response : ResponseInterface
$decoded : array<string, mixed>|null

The decoded body, if it was JSON.

$endpoint : string
Return values
self

getDomain()

Google's error domain, e.g. `youtube.quota`, when it gave one.

public getDomain() : ?string
Return values
?string

getEndpoint()

The API method called, e.g. `liveChatMessages.list`.

public getEndpoint() : string
Return values
string

getErrors()

public getErrors() : array<int, array<string, mixed>>
Return values
array<int, array<string, mixed>> —

Every entry of the error's errors list.

getReason()

Google's reason code, e.g. `quotaExceeded`, when it gave one.

public getReason() : ?string
Return values
?string

getResponse()

public getResponse() : ?ResponseInterface
Return values
?ResponseInterface

getRetryAfter()

Seconds to wait before trying again, when the response said.

public getRetryAfter() : ?float
Return values
?float

getStatus()

The HTTP status, or 0 when there was no response.

public getStatus() : int
Return values
int
On this page

Search results