Automattic\WooCommerce\Internal\Admin\Schedulers

MailchimpScheduler::handle_request_error()privateWC 1.0

Handle subscribe API error.

{} It's a method of the class: MailchimpScheduler{}

No Hooks.

Return

null. Nothing.

Usage

// private - for code of main (parent) class only
$result = $this->handle_request_error( $extra_msg );
$extra_msg(string)
Extra message to log.
Default: null

Code of MailchimpScheduler::handle_request_error() WC 6.6.1

private function handle_request_error( $extra_msg = null ) {
	// phpcs:ignore
	$msg = isset( $extra_msg ) ? 'Incorrect response from Mailchimp API with: ' . print_r( $extra_msg, true ) : 'Error getting a response from Mailchimp API.';

	$this->logger->error( $msg, array( 'source' => self::LOGGER_CONTEXT ) );

	$accumulated_error_count = intval( get_option( self::SUBSCRIBED_ERROR_COUNT_OPTION_NAME, 0 ) ) + 1;
	update_option( self::SUBSCRIBED_ERROR_COUNT_OPTION_NAME, $accumulated_error_count );
}