Skip to content

Commit 39ebb84

Browse files
committed
[Mailer] added debug info to TransportExceptionInterface
1 parent 253d6f5 commit 39ebb84

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

src/Symfony/Component/Mailer/Exception/TransportException.php

+11
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,15 @@
1616
*/
1717
class TransportException extends RuntimeException implements TransportExceptionInterface
1818
{
19+
private $debug = '';
20+
21+
public function getDebug(): string
22+
{
23+
return $this->debug;
24+
}
25+
26+
public function appendDebug(string $debug): void
27+
{
28+
$this->debug .= $debug;
29+
}
1930
}

src/Symfony/Component/Mailer/Exception/TransportExceptionInterface.php

+3
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,7 @@
1616
*/
1717
interface TransportExceptionInterface extends ExceptionInterface
1818
{
19+
public function getDebug(): string;
20+
21+
public function appendDebug(string $debug): void;
1922
}

src/Symfony/Component/Mailer/Transport/Smtp/SmtpTransport.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,11 @@ protected function doSend(SentMessage $message): void
157157
}
158158
$this->stream->flush();
159159
$this->executeCommand("\r\n.\r\n", [250]);
160-
} finally {
161160
$message->appendDebug($this->stream->getDebug());
161+
} catch (TransportExceptionInterface $e) {
162+
$e->appendDebug($this->stream->getDebug());
163+
164+
throw $e;
162165
}
163166
}
164167

0 commit comments

Comments
 (0)