Automattic\WooCommerce\Admin\PluginsInstallLoggers

AsyncPluginsInstallLogger::add_error()publicWC 1.0

Add an error.

Method of the class: AsyncPluginsInstallLogger{}

No Hooks.

Return

null. Nothing (null).

Usage

$AsyncPluginsInstallLogger = new AsyncPluginsInstallLogger();
$AsyncPluginsInstallLogger->add_error( $plugin_name, $error_message );
$plugin_name(string) (required)
plugin name.
$error_message(string|null)
error message.
Default: null

AsyncPluginsInstallLogger::add_error() code WC 9.0.1

public function add_error( string $plugin_name, string $error_message = null ) {
	$option = $this->get();

	$option['plugins'][ $plugin_name ]['errors'][] = $error_message;
	$option['plugins'][ $plugin_name ]['status']   = 'failed';
	$option['status']                              = 'failed';

	wc_admin_record_tracks_event(
		'coreprofiler_store_extension_installed_and_activated',
		array(
			'success'       => false,
			'extension'     => $plugin_name,
			'error_message' => $error_message,
		)
	);

	$this->update( $option );
}