exception_notification
exception_notification copied to clipboard
over ride the default email address while sending emails
you can configure the default email addresses when adding the middleware like this:
options = {
email: {
sender_address: %{[email protected]},
exception_recipients: %w{[email protected]},
}
}
config.middleware.use ExceptionNotification::Rack, options
and then override them when you manually call ExceptionNotifier.notify_exception
ExceptionNotifier.notify_exception(
exception,
sender_address: %{[email protected]>},
exception_recipients: %w{[email protected]},
)
Or if you want to override them for unhandled exceptions, you can set request.env['exception_notifier.options']:
class HomeController < ApplicationController
before_action :set_exception_notification_options
def index
123/0
render :index
end
def set_exception_notification_options
request.env['exception_notifier.options'] = {
sender_address: %{[email protected]},
exception_recipients: %w{[email protected]}
}
end
end