Last active
July 27, 2017 16:09
-
-
Save eliotsykes/56d08053da650c93d48ef5be90493e60 to your computer and use it in GitHub Desktop.
Check Rollbar is reporting errors raised in rake tasks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create file at lib/tasks/check_rollbar.rake | |
require 'securerandom' | |
# Run this with `heroku run rake check_rollbar` | |
desc "Check Rollbar reports errors raised in Rake tasks" | |
task check_rollbar: :environment do | |
unique_msg = "Hello from rake check_rollbar (unique identifier: #{SecureRandom.hex})" | |
begin | |
raise ActiveRecord::RecordNotFound, unique_msg | |
ensure | |
puts "Check your Rollbar dashboard for an ActiveRecord::RecordNotFound error in production with the unique message '#{unique_msg}'" | |
puts "If Rollbar has not reported the exact error, then Rollbar will not report errors originating from rake tasks. This is an issue as you'll not know when your rake tasks are failing." | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment