[Mailer] added debug info to TransportExceptionInterface

This commit is contained in:
Fabien Potencier 2019-08-03 10:39:50 +02:00
parent 253d6f52ab
commit 39ebb84602
3 changed files with 18 additions and 1 deletions

View File

@ -16,4 +16,15 @@ namespace Symfony\Component\Mailer\Exception;
*/
class TransportException extends RuntimeException implements TransportExceptionInterface
{
private $debug = '';
public function getDebug(): string
{
return $this->debug;
}
public function appendDebug(string $debug): void
{
$this->debug .= $debug;
}
}

View File

@ -16,4 +16,7 @@ namespace Symfony\Component\Mailer\Exception;
*/
interface TransportExceptionInterface extends ExceptionInterface
{
public function getDebug(): string;
public function appendDebug(string $debug): void;
}

View File

@ -157,8 +157,11 @@ class SmtpTransport extends AbstractTransport
}
$this->stream->flush();
$this->executeCommand("\r\n.\r\n", [250]);
} finally {
$message->appendDebug($this->stream->getDebug());
} catch (TransportExceptionInterface $e) {
$e->appendDebug($this->stream->getDebug());
throw $e;
}
}