-
Notifications
You must be signed in to change notification settings - Fork 103
Home
Kevin Disneur edited this page Feb 27, 2017
·
1 revision
- How to catch specific errors?
The specific error tuple containing the error is stored inside the Bamboo.SMTPAdapter.SMTPError
structure. You could access it this way:
def send_an_email(email) do
try do
MyApp.Mailer.deliver_now(email)
rescue
error in Bamboo.SMTPAdapter.SMTPError ->
case error.raw do
{:retries_exceeded, _} ->
IO.inspect("I can do some stuff when this error match")
_ ->
IO.inspect "I don't care about these ones"
end
# Here, I can re-raise the error
raise error
end
end