i have rails 4 application entirely comprised of rails runners on cron generated whenever gem.
i'd notified if there exceptions occur during run. exception_notification gem runs rack middleware (web requests only), doesn't handle rails runners.
any ideas? i'm looking notified on email or on slack.
you can use exceptionnotifier.notify_exception
in rescue block send notification.
for example:
def rescue_exception(data) yield rescue => e exceptionnotifier.notify_exception(e, data: data) end every :hour rescue_exception(runner: 'somemodel.some_method') runner "somemodel.some_method" end end
please refer https://github.com/smartinez87/exception_notification#background-notifications. use data
hash pass additional information context.