WordPress\AiClient\Providers\Http\Exception
ResponseException::fromInvalidData
Creates a ResponseException from invalid data in an API response.
Method of the class: ResponseException{}
No Hooks.
Returns
self.
Usage
$result = ResponseException::fromInvalidData( $apiName, $fieldName, $message ): self;
- $apiName(string) (required)
- The name of the API service (e.g.,
'OpenAI', 'Anthropic'). - $fieldName(string) (required)
- The field that was invalid.
- $message(string) (required)
- The specific error message describing the invalid data.
Changelog
| Since 0.2.0 | Introduced. |
ResponseException::fromInvalidData() ResponseException::fromInvalidData code WP 7.0
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));
}