ResponseException::fromInvalidData( string $apiName, string $fieldName, string $message ): self

In this article

Creates a ResponseException from invalid data in an API response.

Parameters

$apiNamestringrequired
The name of the API service (e.g., 'OpenAI', 'Anthropic').
$fieldNamestringrequired
The field that was invalid.
$messagestringrequired
The specific error message describing the invalid data.

Return

self

Source

public static function fromInvalidData(string $apiName, string $fieldName, string $message): self
{
    return new self(sprintf('Unexpected %s API response: Invalid "%s" key: %s', $apiName, $fieldName, $message));
}

Changelog

VersionDescription
0.2.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.