Skip to content
This repository has been archived by the owner on Nov 17, 2021. It is now read-only.

Commit

Permalink
tweaked error message when response is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Sep 11, 2018
1 parent dd8f20b commit 5a6992d
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lib/classes/Swift/Transport/AbstractSmtpTransport.php
Expand Up @@ -443,6 +443,10 @@ protected function throwException(Swift_TransportException $e)
/** Throws an Exception if a response code is incorrect */
protected function assertResponseCode($response, $wanted)
{
if (!$response) {
$this->throwException(new Swift_TransportException('Expected response code '.implode('/', $wanted).' but got an empty response'));
}

list($code) = sscanf($response, '%3d');
$valid = (empty($wanted) || in_array($code, $wanted));

Expand All @@ -452,12 +456,7 @@ protected function assertResponseCode($response, $wanted)
}

if (!$valid) {
$this->throwException(
new Swift_TransportException(
'Expected response code '.implode('/', $wanted).' but got code '.
'"'.$code.'", with message "'.$response.'"',
$code)
);
$this->throwException(new Swift_TransportException('Expected response code '.implode('/', $wanted).' but got code "'.$code.'", with message "'.$response.'"', $code));
}
}

Expand Down

0 comments on commit 5a6992d

Please sign in to comment.