Read more

Exception notifier: How to provide custom data to fail mails

Emanuel
November 13, 2018Software engineer at makandra GmbH

The exception_notification Show archive.org snapshot gem supports to provide custom data to e.g. the fail mail within foreground or background jobs.

ExceptionNotifier.notify_exception(_ex_, :data => {:message => "was doing something wrong"})
Illustration web development

Do you need DevOps-experts?

Your development team has a full backlog? No time for infrastructure architecture? Our DevOps team is ready to support you!

  • We build reliable cloud solutions with Infrastructure as code
  • We are experts in security, Linux and databases
  • We support your dev team to perform
Read more Show archive.org snapshot

Still this can be blocked if you have an initializer where you override the default sections and background_sections option. So remember to add the data option to the desired section if required. In case you raise an exception without a data object, the fail mail still contains an empty data section.

require 'exception_notification/rails'

ExceptionNotification.configure do |config|

  config.add_notifier :email, {
    sections: %w[data request backtrace],
    background_sections: %w[data backtrace],
  }

end

Posted by Emanuel to makandra dev (2018-11-13 15:41)