We want to process errors for individual subscribers. Subscriber errors were inlined into error message string. This commit changes this so that we are now able to get subscriber errors as a data which are easy to process further. [MAILPOET-1154]
27 lines
888 B
PHP
27 lines
888 B
PHP
<?php
|
|
namespace MailPoet\Mailer\Methods\ErrorMappers;
|
|
|
|
use MailPoet\Mailer\MailerError;
|
|
use MailPoet\Mailer\Mailer;
|
|
use MailPoet\Mailer\SubscriberError;
|
|
|
|
class AmazonSESMapper {
|
|
use ConnectionErrorMapperTrait;
|
|
|
|
function getErrorFromException(\Exception $e) {
|
|
return new MailerError(MailerError::OPERATION_SEND, MailerError::LEVEL_HARD, $e->getMessage());
|
|
}
|
|
|
|
function getErrorFromResponse($response, $subscriber, $extra_params) {
|
|
$response = ($response) ?
|
|
$response->Error->Message->__toString() :
|
|
sprintf(__('%s has returned an unknown error.', 'mailpoet'), Mailer::METHOD_AMAZONSES);
|
|
|
|
$subscriber_errors = [];
|
|
if(empty($extra_params['test_email'])) {
|
|
$subscriber_errors[] = new SubscriberError($subscriber, null);
|
|
}
|
|
return new MailerError(MailerError::OPERATION_SEND, MailerError::LEVEL_HARD, $response, null, $subscriber_errors);
|
|
}
|
|
}
|