Make rendering error during sending more descriptive [MAILPOET-1232]
This commit is contained in:
@@ -392,6 +392,10 @@ const MailerMixin = {
|
|||||||
MailPoet.I18n.t('mailerConnectionErrorNotice')
|
MailPoet.I18n.t('mailerConnectionErrorNotice')
|
||||||
.replace('%$1s', state.meta.mta_log.error.error_message);
|
.replace('%$1s', state.meta.mta_log.error.error_message);
|
||||||
}
|
}
|
||||||
|
if (state.meta.mta_log.error.error_code) {
|
||||||
|
mailer_error_notice += ' ' + MailPoet.I18n.t('mailerErrorCode')
|
||||||
|
.replace('%$1s', state.meta.mta_log.error.error_code);
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<p>{ mailer_error_notice }</p>
|
<p>{ mailer_error_notice }</p>
|
||||||
|
@@ -57,7 +57,7 @@ class Newsletter {
|
|||||||
// return the newsletter if it was previously rendered
|
// return the newsletter if it was previously rendered
|
||||||
if(!is_null($queue->getNewsletterRenderedBody())) {
|
if(!is_null($queue->getNewsletterRenderedBody())) {
|
||||||
return (!$queue->validate()) ?
|
return (!$queue->validate()) ?
|
||||||
$this->stopNewsletterPreProcessing() :
|
$this->stopNewsletterPreProcessing(sprintf('QUEUE-%d-RENDER', $queue->id)) :
|
||||||
$newsletter;
|
$newsletter;
|
||||||
}
|
}
|
||||||
// if tracking is enabled, do additional processing
|
// if tracking is enabled, do additional processing
|
||||||
@@ -111,7 +111,7 @@ class Newsletter {
|
|||||||
$queue_errors = ($queue->validate() !== true);
|
$queue_errors = ($queue->validate() !== true);
|
||||||
}
|
}
|
||||||
if($queue_errors) {
|
if($queue_errors) {
|
||||||
$this->stopNewsletterPreProcessing();
|
$this->stopNewsletterPreProcessing(sprintf('QUEUE-%d-SAVE', $queue->id));
|
||||||
}
|
}
|
||||||
return $newsletter;
|
return $newsletter;
|
||||||
}
|
}
|
||||||
@@ -169,10 +169,11 @@ class Newsletter {
|
|||||||
return Helpers::flattenArray($segments);
|
return Helpers::flattenArray($segments);
|
||||||
}
|
}
|
||||||
|
|
||||||
function stopNewsletterPreProcessing() {
|
function stopNewsletterPreProcessing($error_code = null) {
|
||||||
MailerLog::processError(
|
MailerLog::processError(
|
||||||
'queue_save',
|
'queue_save',
|
||||||
__('There was an error processing your newsletter during sending. If possible, please contact us and report this issue.')
|
__('There was an error processing your newsletter during sending. If possible, please contact us and report this issue.'),
|
||||||
|
$error_code
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -75,7 +75,7 @@ class MailerLog {
|
|||||||
return self::resetMailerLog();
|
return self::resetMailerLog();
|
||||||
}
|
}
|
||||||
|
|
||||||
static function processError($operation, $error_message) {
|
static function processError($operation, $error_message, $error_code = null) {
|
||||||
$mailer_log = self::getMailerLog();
|
$mailer_log = self::getMailerLog();
|
||||||
(int)$mailer_log['retry_attempt']++;
|
(int)$mailer_log['retry_attempt']++;
|
||||||
$mailer_log['retry_at'] = time() + self::RETRY_INTERVAL;
|
$mailer_log['retry_at'] = time() + self::RETRY_INTERVAL;
|
||||||
@@ -83,6 +83,9 @@ class MailerLog {
|
|||||||
'operation' => $operation,
|
'operation' => $operation,
|
||||||
'error_message' => $error_message
|
'error_message' => $error_message
|
||||||
);
|
);
|
||||||
|
if($error_code) {
|
||||||
|
$mailer_log['error']['error_code'] = $error_code;
|
||||||
|
}
|
||||||
self::updateMailerLog($mailer_log);
|
self::updateMailerLog($mailer_log);
|
||||||
return self::enforceExecutionRequirements();
|
return self::enforceExecutionRequirements();
|
||||||
}
|
}
|
||||||
|
@@ -257,6 +257,7 @@
|
|||||||
|
|
||||||
'mailerSendErrorNotice': __('Sending is paused because %$1s prevents MailPoet from delivering emails with the following error: %$2s'),
|
'mailerSendErrorNotice': __('Sending is paused because %$1s prevents MailPoet from delivering emails with the following error: %$2s'),
|
||||||
'mailerConnectionErrorNotice': __('Sending is paused because the following connection issue prevents MailPoet from delivering emails: %$1s'),
|
'mailerConnectionErrorNotice': __('Sending is paused because the following connection issue prevents MailPoet from delivering emails: %$1s'),
|
||||||
|
'mailerErrorCode': __('Error code: %$1s'),
|
||||||
'mailerCheckSettingsNotice': __('Check your [link]sending method settings[/link].'),
|
'mailerCheckSettingsNotice': __('Check your [link]sending method settings[/link].'),
|
||||||
'mailerResumeSendingButton': __('Resume sending'),
|
'mailerResumeSendingButton': __('Resume sending'),
|
||||||
'mailerSendingResumedNotice': __('Sending has been resumed.'),
|
'mailerSendingResumedNotice': __('Sending has been resumed.'),
|
||||||
|
Reference in New Issue
Block a user