Automattic\WooCommerce\Internal\Api

QueryCache::error_responseprivateWC 1.0

Build a GraphQL-shaped error response array.

Method of the class: QueryCache{}

No Hooks.

Returns

Array.

Usage

// private - for code of main (parent) class only
$result = $this->error_response( $message, $code ): array;
$message(string) (required)
The error message.
$code(string) (required)
The error code for extensions.

QueryCache::error_response() code WC 10.9.4

private function error_response( string $message, string $code ): array {
	return array(
		'errors' => array(
			array(
				'message'    => $message,
				'extensions' => array( 'code' => $code ),
			),
		),
	);
}