wc_caught_exception( Exception $exception_object, string $function = '', array $args = array() )

When catching an exception, this allows us to log it if unexpected.


Description Description


Parameters Parameters

$exception_object

(Required) The exception object.

$function

(Optional) The function which threw exception.

Default value: ''

$args

(Optional) The args passed to the function.

Default value: array()


Top ↑

Source Source

File: includes/wc-deprecated-functions.php

function wc_caught_exception( $exception_object, $function = '', $args = array() ) {
	// @codingStandardsIgnoreStart
	$message  = $exception_object->getMessage();
	$message .= '. Args: ' . print_r( $args, true ) . '.';

	do_action( 'woocommerce_caught_exception', $exception_object, $function, $args );
	error_log( "Exception caught in {$function}. {$message}." );
	// @codingStandardsIgnoreEnd
}

Top ↑

Changelog Changelog

Changelog
Version Description
3.3.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.