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 money motivation

Opscomplete powered by makandra brand

Save money by migrating from AWS to our fully managed hosting in Germany.

  • Trusted by over 100 customers
  • Ready to use with Ruby, Node.js, PHP
  • Proactive management by operations experts
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)