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

Document action mailer rescue_from [ci-skip] #44777

Merged
merged 1 commit into from May 3, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 23 additions & 0 deletions actionmailer/lib/action_mailer/base.rb
Expand Up @@ -342,6 +342,29 @@ module ActionMailer
# using <tt>before_action</tt> rather than <tt>after_action</tt> in your
# Action Mailer classes so that headers are parsed properly.
#
# = Rescuing Errors
#
# +rescue+ blocks inside of a mailer method cannot rescue errors that occur
# outside of rendering -- for example, record deserialization errors in a
# background job, or errors from a third-party mail delivery service.
#
# To rescue errors that occur during any part of the mailing process, use
# {rescue_from}[rdoc-ref:ActiveSupport::Rescuable::ClassMethods#rescue_from]:
#
# class NotifierMailer < ApplicationMailer
# rescue_from ActiveJob::DeserializationError do
# # ...
# end
#
# rescue_from "SomeThirdPartyService::ApiError" do
# # ...
# end
#
# def notify(recipient)
# mail(to: recipient, subject: "Notification")
# end
# end
#
# = Previewing emails
#
# You can preview your email templates visually by adding a mailer preview file to the
Expand Down