OpenBuildings / postmark

Postmark transport for Swift Mailer
https://github.com/OpenBuildings/postmark
BSD 3-Clause "New" or "Revised" License
16 stars 8 forks source link

Send only \Swift_TransportException #27

Closed romaricdrigon closed 8 years ago

romaricdrigon commented 8 years ago

Hi,

In case of API errors, the mailer throws "regular" \Exception. SwiftMailer includes a specific Exception class, \Swift_TransportException. Only those are catched by various plugins and decorators. Then using those - or extending those to something like PostMarkApiException would be nice!

hkdobrev commented 8 years ago

Hi @romaricdrigon,

Thanks for this! We could definitely make use of the \Swift_TransportException. However in the time being you could catch Postmark\Exception which extends \Exception for Postmark API errors. Its code is set to the API error code which Postmark uses. https://github.com/OpenBuildings/postmark/blob/a51bb76b79164ef251c4dba48678f37df3ad3d86/src/Exception.php

romaricdrigon commented 8 years ago

Definitely, for now I overrode SwiftMailer bundle listener to catch exceptions :)

hkdobrev commented 8 years ago

@romaricdrigon Would you be interested in opening a pull request with this change?

romaricdrigon commented 8 years ago

Sure, right away!

romaricdrigon commented 8 years ago

Closing issue in favor of PR #28