Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrap errors in SMTPError to comply with Adapter.deliver/2 spec #216

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

adamu
Copy link

@adamu adamu commented Sep 14, 2022

In #177, this adapter was updated to comply with the new spec in Bamboo v2.

However, as suggested in this comment, it is still necessary to wrap the errors in SMTPError. This is because the Adapter.error/0 spec requires that the error must be a Exception.t() | String.t().

Currently, bamboo_smtp is returning the underlying error tuple from gen_smtp, which is a violation of the spec and causes Elixir to complain when Bamboo raises the exception. An example I have seen in server logs:

ArgumentError: raise/1 and reraise/2 expect a module name, string or exception as the first argument, got: {:network_failure, '74.125.204.108', {:error, :closed}}

This PR wraps the errors in SMTPError to comply with the spec, so that it can be successfully raised by Bamboo without causing ArgumentErrors from raise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant