-
Notifications
You must be signed in to change notification settings - Fork 4
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
Breaking changes coming to Bamboo v2.0.0 #4
Comments
@egeersoz, I'm busy over the next week, but I'll try and take a look. PRs are always welcome. |
adkron
added a commit
that referenced
this issue
Apr 11, 2023
Bamboo changed the API signature for bamboo 2.0.0 for adapters. deliver/2 must now return an :ok or :error tuple. Since we are delegating to the next adapter and only updating the config, we can leave that change to the downstream adapter. The other change is that the adapter must implement supports_attachments?/0. Since we delegate, we don't know if we support attachments. Since the function must be there and we have no access to the data to say if attachments are supported, I've decided always to return true. Closes #4
adkron
added a commit
that referenced
this issue
Aug 8, 2023
* Adds support for Bamboo 2.0.0 Bamboo changed the API signature for bamboo 2.0.0 for adapters. deliver/2 must now return an :ok or :error tuple. Since we are delegating to the next adapter and only updating the config, we can leave that change to the downstream adapter. The other change is that the adapter must implement supports_attachments?/0. Since we delegate, we don't know if we support attachments. Since the function must be there and we have no access to the data to say if attachments are supported, I've decided always to return true. Closes #4 * initial work * more doco and test_mode --------- Co-authored-by: Amos L King <amos@binarynoggin.com>
adkron
added a commit
that referenced
this issue
Aug 8, 2023
* Adds support for Bamboo 2.0.0 Bamboo changed the API signature for bamboo 2.0.0 for adapters. deliver/2 must now return an :ok or :error tuple. Since we are delegating to the next adapter and only updating the config, we can leave that change to the downstream adapter. The other change is that the adapter must implement supports_attachments?/0. Since we delegate, we don't know if we support attachments. Since the function must be there and we have no access to the data to say if attachments are supported, I've decided always to return true. Closes #4 * initial work * more doco and test_mode * Fixed failing tests - Amos --------- Co-authored-by: Amos L King <amos@binarynoggin.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
👋 Hey Amos,
Thanks for maintaining this Bamboo adapter. 🥳
There will be a breaking change coming to Bamboo in v2.0.0 where the
deliver_now
function will no longer raise an error on failure to deliver an email. Instead, it will return:ok
or:error
tuples. That way, users of the library can decide how to handle the errors. I've completed that work in beam-community/bamboo#571.I've also added a
deliver_now!
function that is meant to behave exactly asdeliver_now
currently behaves. So, there's an easy upgrade path for users who don't want to handle their own errors. They can changedeliver_now
->deliver_now!
.(There are also
deliver_later
corresponding changes, but from the adapter's perspective, I don't know that it matters).What that means for adapters
In order for people to upgrade to Bamboo v2.0.0, the adapters will need to stop raising errors when they fail to deliver emails. In order to accommodate that, the adapter's callbacks are changing like this:
In other words, adapters should now return an
{:ok, response}
tuple or an{:error, error}
tuple, where the error is either an exception struct that can later be raised or an error message.To facilitate that work, PR 571 also introduces a
Bamboo.ApiError.build_api_error
function that can be used by adapters — if you want to easily build an error to return in the{:error, error}
response.Sample changes to other adapters
I have already done some changes to the Sendgrid, Mailgun, and Mandrill adapters. They might serve as a guide:
Why open this issue?
I wanted to open this issue for two reasons:
Unfortunately, I can't offer to open PRs to make the changes in all the adapter repos, but if it's helpful, I'd be happy to review PRs.
And if there's some change to Bamboo that would make it easier to work with your adapter, or if you have suggestions or comments on PR 571, I'd love to know.
Thanks again for maintaining this adapter, and please feel free to close this issue whenever you've read it (if it's of no further use). It just seemed like the easiest way to communicate about the upcoming changes with you.
The text was updated successfully, but these errors were encountered: