Automattic\WooCommerce\Internal\EmailEditor\WCTransactionalEmails
WCEmailTemplateAutoApplier::log_apply_error
Map a per-post WP_Error from {@see self::apply_to_post()} to the right log severity and emit it.
post_modified_since_stamp is the expected race outcome (merchant edit in the AS lag window) and is logged at info. Everything else is at warning or error so it surfaces in the default WC log UI.
Метод класса: WCEmailTemplateAutoApplier{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$result = WCEmailTemplateAutoApplier::log_apply_error( $error, $post_id, $email_id ): void;
- $error(WP_Error) (обязательный)
- The error returned by apply_to_post.
- $post_id(int) (обязательный)
- Post ID being processed.
- $email_id(строка) (обязательный)
- Email ID being processed.
Код WCEmailTemplateAutoApplier::log_apply_error() WCEmailTemplateAutoApplier::log apply error WC 10.9.1
private static function log_apply_error( \WP_Error $error, int $post_id, string $email_id ): void {
$message = sprintf(
'Email template auto-apply skipped post %d for email "%s": %s',
$post_id,
$email_id,
$error->get_error_message()
);
$context = array(
'post_id' => $post_id,
'email_id' => $email_id,
'context' => 'email_template_auto_applier',
);
switch ( $error->get_error_code() ) {
case 'post_modified_since_stamp':
self::get_logger()->info( $message, $context );
return;
case 'no_stored_hash':
case 'not_sync_enabled':
self::get_logger()->warning( $message, $context );
return;
default:
self::get_logger()->error( $message, $context );
}
}