Skip to content

Commit

Permalink
More verbose exception message
Browse files Browse the repository at this point in the history
  • Loading branch information
Rogov Viktor committed Feb 16, 2015
1 parent 5449699 commit 6893cfe
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Smtp.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,10 @@ protected function _readResponse($expected, $prevException = null)
$this->_log .= $response;

if (substr($response, 0, 3) != $expected) {
throw new Exception("Unexpected response {$response}. Expected {$expected}. Here is the dialog dump:\n{$this->_log}", 0, $prevException);
$type = gettype($response);
$eof = feof($this->_smtp) ? 'EOF - true' : 'EOF - false';
$msg = "Unexpected response {$type}:'{$response}'. {$eof}. Expected {$expected}. Here is the dialog dump:\n{$this->_log}";
throw new Exception($msg, 0, $prevException);
}

return $response;
Expand Down

0 comments on commit 6893cfe

Please sign in to comment.