We want to add some logic to error handling. This commit extracts error handling code from sending methods classes, which already do a lot of other stuff, to error mappers which are responsible for creating proper error object (MailerError). This error object is a replacement for assoc. array which already had some special keys for certain usecases and can not be properly type hinted. [MAILPOET-1154]
15 lines
291 B
PHP
15 lines
291 B
PHP
<?php
|
|
namespace MailPoet\Mailer\Methods\ErrorMappers;
|
|
|
|
use MailPoet\Mailer\MailerError;
|
|
|
|
trait ConnectionErrorMapperTrait {
|
|
function getConnectionError($message) {
|
|
return new MailerError(
|
|
MailerError::OPERATION_CONNECT,
|
|
MailerError::LEVEL_HARD,
|
|
$message
|
|
);
|
|
}
|
|
}
|