QuotaExceededException
extends HttpException
in package
The day's quota is spent: Google said `quotaExceeded`, or the {@see Meter} refused the call before it was sent because it could not pay for it.
Quota resets at midnight Pacific time, which getResetsAt() gives when the meter knows it. A refusal made locally has status 0: YouTube never saw the request, and it cost nothing.
Tags
Table of Contents
Properties
- $resetsAt : ?CarbonImmutable
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.
- getResetsAt() : ?CarbonImmutable
- When the quota comes back, if the meter knows.
- 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.
- isLocal() : bool
- True when the meter refused it and YouTube never saw the request.
- local() : self
- Refused before sending: the meter could not pay for the call.
Properties
$resetsAt
private
?CarbonImmutable
$resetsAt
= null
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
errorslist. - $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
codeis used when it has one. - $endpoint : string
- $response : ?ResponseInterface = null
Return values
selffromResponse()
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
selfgetDomain()
Google's error domain, e.g. `youtube.quota`, when it gave one.
public
getDomain() : ?string
Return values
?stringgetEndpoint()
The API method called, e.g. `liveChatMessages.list`.
public
getEndpoint() : string
Return values
stringgetErrors()
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
?stringgetResetsAt()
When the quota comes back, if the meter knows.
public
getResetsAt() : ?CarbonImmutable
Return values
?CarbonImmutablegetResponse()
public
getResponse() : ?ResponseInterface
Return values
?ResponseInterfacegetRetryAfter()
Seconds to wait before trying again, when the response said.
public
getRetryAfter() : ?float
Return values
?floatgetStatus()
The HTTP status, or 0 when there was no response.
public
getStatus() : int
Return values
intisLocal()
True when the meter refused it and YouTube never saw the request.
public
isLocal() : bool
Return values
boollocal()
Refused before sending: the meter could not pay for the call.
public
static local(string $endpoint, Meter $meter) : self
Parameters
- $endpoint : string
- $meter : Meter