Automattic\WooCommerce\Database\Migrations\CustomOrderTable

PostsToOrdersMigrationController::handle_migration_error()privateWC 1.0

Log migration errors if any.

Метод класса: PostsToOrdersMigrationController{}

Хуков нет.

Возвращает

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

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

// private - только в коде основоного (родительского) класса
$result = $this->handle_migration_error( $order_post_ids, $errors, ?\Exception $exception, ?bool $using_transactions, $name );
$order_post_ids(массив) (обязательный)
List of post IDs of the orders to migrate.
$errors(массив) (обязательный)
List of errors to log.
?\Exception $exception (обязательный)
-
?bool $using_transactions (обязательный)
-
$name(строка) (обязательный)
Name of the migrator.

Код PostsToOrdersMigrationController::handle_migration_error() WC 9.2.3

private function handle_migration_error( array $order_post_ids, array $errors, ?\Exception $exception, ?bool $using_transactions, string $name ) {
	$batch = ArrayUtil::to_ranges_string( $order_post_ids );

	if ( null !== $exception ) {
		$exception_class = get_class( $exception );
		$this->error_logger->error(
			"$name: when processing ids $batch: ($exception_class) {$exception->getMessage()}, {$exception->getTraceAsString()}",
			array(
				'source'    => self::LOGS_SOURCE_NAME,
				'ids'       => $order_post_ids,
				'exception' => $exception,
			)
		);
	}

	foreach ( $errors as $error ) {
		$this->error_logger->error(
			"$name: when processing ids $batch: $error",
			array(
				'source' => self::LOGS_SOURCE_NAME,
				'ids'    => $order_post_ids,
				'error'  => $error,
			)
		);
	}

	if ( $using_transactions ) {
		$this->rollback_transaction();
	}
}