wc_caught_exception()WC 3.3.0

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

Хуки из функции

Возвращает

null. Ничего (null).

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

wc_caught_exception( $exception_object, $function, $args );
$exception_object(Exception) (обязательный)
The exception object.
$function(строка)
The function which threw exception.
По умолчанию: ''
$args(массив)
The args passed to the function.
По умолчанию: array()

Список изменений

С версии 3.3.0 Введена.

Код wc_caught_exception() WC 8.7.0

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
}