Skip to content

Commit

Permalink
bug #32895 [Mailer] Fix error not being thrown properly (fabpot)
Browse files Browse the repository at this point in the history
This PR was merged into the 4.3 branch.

Discussion
----------

[Mailer] Fix error not being thrown properly

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

When the SMTP server returns a fatal error, the error is not thrown properly as catched and another error (empty) is thrown. That makes debugging very difficult and what we would expect anyway.

Commits
-------

15dbe4b [Mailer] fixed error that is masked by another error
  • Loading branch information
fabpot committed Aug 3, 2019
2 parents 8e3161b + 15dbe4b commit e248345
Showing 1 changed file with 5 additions and 1 deletion.
Expand Up @@ -114,7 +114,11 @@ public function send(RawMessage $message, SmtpEnvelope $envelope = null): ?SentM
try {
$message = parent::send($message, $envelope);
} catch (TransportExceptionInterface $e) {
$this->executeCommand("RSET\r\n", [250]);
try {
$this->executeCommand("RSET\r\n", [250]);
} catch (TransportExceptionInterface $_) {
// ignore this exception as it probably means that the server error was final
}

throw $e;
}
Expand Down

0 comments on commit e248345

Please sign in to comment.