Add handling for more 5xx errors from the bridge

[MAILPOET-4209]
This commit is contained in:
Jan Lysý
2022-05-04 13:28:53 +02:00
committed by Veljko V
parent 0996a64f32
commit 32c27b91c1
3 changed files with 21 additions and 0 deletions

View File

@@ -184,4 +184,19 @@ class MailPoetMapperTest extends \MailPoetUnitTest {
expect($error->getMessage())->stringContainsString("Youll soon be able to send once our team reviews your account.");
}
public function testGetUnavailableServiceError() {
$apiResult = [
'code' => API::RESPONSE_CODE_GATEWAY_TIMEOUT,
'status' => API::SENDING_STATUS_SEND_ERROR,
'message' => 'Service is temporary unavailable',
];
$error = $this->mapper->getErrorForResult($apiResult, $this->subscribers);
expect($error)->isInstanceOf(MailerError::class);
expect($error->getRetryInterval())->equals(MailPoetMapper::TEMPORARY_UNAVAILABLE_RETRY_INTERVAL);
expect($error->getOperation())->equals(MailerError::OPERATION_SEND);
expect($error->getLevel())->equals(MailerError::LEVEL_HARD);
expect($error->getMessage())->equals('Email service is temporarily not available, please try again in a few minutes.');
}
}