1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/actionmailer/lib/action_mailer/rescuable.rb

30 lines
652 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2021-07-29 17:18:07 -04:00
module ActionMailer # :nodoc:
# Provides +rescue_from+ for mailers. Wraps mailer action processing,
# mail job processing, and mail delivery.
module Rescuable
extend ActiveSupport::Concern
include ActiveSupport::Rescuable
class_methods do
2021-07-29 17:18:07 -04:00
def handle_exception(exception) # :nodoc:
rescue_with_handler(exception) || raise(exception)
end
end
2021-07-29 17:18:07 -04:00
def handle_exceptions # :nodoc:
yield
rescue => exception
rescue_with_handler(exception) || raise
end
private
def process(*)
handle_exceptions do
super
end
end
end
end