Automattic\WooCommerce\Internal\OrderWithdrawal

OrderWithdrawalFormProcessor::log_order_note_error │ private │ WC 1.0

Log an order note failure without failing the submission.

Method of the class: OrderWithdrawalFormProcessor{}

No Hooks.

Returns

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->log_order_note_error( $order, ?Throwable $e ): void;
$order(WC_Order) (required)
Matched order.
?Throwable $e
.
Default: null

OrderWithdrawalFormProcessor::log_order_note_error() code WC 11.1.2

private function log_order_note_error( WC_Order $order, ?Throwable $e = null ): void {
	$message = sprintf( 'Order withdrawal note could not be added to order %d.', $order->get_id() );

	if ( $e instanceof Throwable ) {
		$message .= sprintf( ' Error: %s', $e->getMessage() );
	}

	wc_get_logger()->warning(
		$message,
		array( 'source' => self::LOGGER_SOURCE )
	);
}