WordPress\AiClient\Providers\Http\Exception

ResponseException::fromMissingDatapublic staticWP 0.2.0

Creates a ResponseException for missing expected data.

Method of the class: ResponseException{}

No Hooks.

Returns

self.

Usage

$result = ResponseException::fromMissingData( $apiName, $fieldName ): self;
$apiName(string) (required)
The name of the API/provider.
$fieldName(string) (required)
The field that was expected but missing.

Changelog

Since 0.2.0 Introduced.

ResponseException::fromMissingData() code WP 7.0

public static function fromMissingData(string $apiName, string $fieldName): self
{
    $message = sprintf('Unexpected %s API response: Missing the "%s" key.', $apiName, $fieldName);
    return new self($message);
}