Automattic\WooCommerce\Internal\Admin\Schedulers

MailchimpScheduler::handle_request_error()privateWC 1.0

Handle subscribe API error.

Method of the class: MailchimpScheduler{}

No Hooks.

Return

null. Nothing (null).

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

MailchimpScheduler::handle_request_error() code WC 8.7.0

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 );
}