Automattic\WooCommerce\Internal\Admin\Settings\PaymentsProviders\WooPayments

WooPaymentsService::get_onboarding_client_api_exception_errorprivateWC 1.0

Build a WP_Error for an exception thrown while talking to the internal WooPayments onboarding API.

Method of the class: WooPaymentsService{}

No Hooks.

Returns

WP_Error.

Usage

// private - for code of main (parent) class only
$result = $this->get_onboarding_client_api_exception_error( $e, $message ): WP_Error;
$e(Exception) (required)
The caught exception.
$message(string) (required)
The human-readable, already-escaped error message.

WooPaymentsService::get_onboarding_client_api_exception_error() code WC 11.0.0

private function get_onboarding_client_api_exception_error( Exception $e, string $message ): WP_Error {
	// Deliberately exclude the exception stack trace from this error data. The data is
	// passed to ApiException as additional data (documented as exposable in the error
	// response) and is persisted to the NOX profile option by the onboarding step-failed
	// handlers, so it must stay free of stack frames, whose arguments can carry file
	// paths, tokens, and other sensitive values. Keep only these bounded scalars.
	return new WP_Error(
		'woocommerce_woopayments_onboarding_client_api_exception',
		$message,
		array(
			'code'    => $e->getCode(),
			'message' => $e->getMessage(),
		)
	);
}