beam-community / bamboo

Testable, composable, and adapter based Elixir email library for devs that love piping.
https://hex.pm/packages/bamboo
MIT License
1.9k stars 343 forks source link

Sending errors lead to argument errors #648

Open tillsc opened 1 year ago

tillsc commented 1 year ago

When sending an email fails, bamoo tries to raise an exeption. E.g. this happens here: https://github.com/thoughtbot/bamboo/blob/f29d4984eeb836680acd425b8d44d4d3c7edb606/lib/bamboo/mailer.ex#L234

But error must not always be a string. In our case error sometimes is a Tuple. E.g. like:

{:permanent_failure, '...', "550 5.7.64 TenantAttribution; Relay Access Denied [...]\r\n"})

This leads to an argument error:

ArgumentError raise/1 and reraise/2 expect a module name, string or exception as the first argument, got: ...

Bamboo should ensure to raise strings only. E.g. by using inspect like raise inspect(error).