Automattic\WooCommerce\StoreApi\Routes\V1

AbstractCartRoute::get_cart_session_error_response │ protected │ WC 1.0

Convert a failure during cart session loading into a client-safe error response.

Error details are returned only to managers when debug details are enabled.

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

Хуков нет.

Возвращает

\WP_REST_Response. The error response to return to the client.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_cart_session_error_response( $error );
$error(Throwable) (обязательный)
The error that occurred while loading the cart session.

Код AbstractCartRoute::get_cart_session_error_response() WC 11.3.0

protected function get_cart_session_error_response( \Throwable $error ) {
	return $this->error_to_response(
		UnexpectedErrorResponse::create(
			$error,
			sprintf( '%s while loading the cart session', static::class ),
			__( 'The cart could not be loaded. Please try again.', 'woocommerce' )
		)
	);
}