2017-07-23 11:17:16 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2021-07-29 17:18:07 -04:00
|
|
|
module ActionMailer # :nodoc:
|
2017-08-25 19:40:18 -04:00
|
|
|
# Provides +rescue_from+ for mailers. Wraps mailer action processing,
|
2016-05-13 20:43:48 -04:00
|
|
|
# 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:
|
2016-05-13 20:43:48 -04:00
|
|
|
rescue_with_handler(exception) || raise(exception)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2021-07-29 17:18:07 -04:00
|
|
|
def handle_exceptions # :nodoc:
|
2016-05-13 20:43:48 -04:00
|
|
|
yield
|
|
|
|
rescue => exception
|
|
|
|
rescue_with_handler(exception) || raise
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
def process(*)
|
|
|
|
handle_exceptions do
|
|
|
|
super
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|