Yoast\WP\SEO\AI\Authentication\Application

AI_Request_Sender::error_contextprivateYoast 1.0

Builds the PSR-3 log context for a failed remote request, defaulting a missing error identifier to unknown so the rendered message never has an empty slot.

Метод класса: AI_Request_Sender{}

Хуков нет.

Возвращает

Массив<Строку,. int|string> The log context: error_id, status, message.

Использование

// private - только в коде основоного (родительского) класса
$result = $this->error_context( $exception ): array;
$exception(Remote_Request_Exception) (обязательный)
The failed request exception.

Код AI_Request_Sender::error_context() Yoast 28.3

private function error_context( Remote_Request_Exception $exception ): array {
	$error_id = $exception->get_error_identifier();
	if ( $error_id === '' ) {
		$error_id = 'unknown';
	}

	return [
		'error_id' => $error_id,
		'status'   => $exception->getCode(),
		'message'  => $exception->getMessage(),
	];
}