This repository has been archived by the owner on Jan 19, 2023. It is now read-only.
forked from airbrake/airbrake
-
Notifications
You must be signed in to change notification settings - Fork 0
Using Airbrake with Rake
Kyrylo Silin edited this page Aug 24, 2016
·
7 revisions
END OF SUPPORT WARNING: On November 24, 2016 Airbrake v4 won't be supported anymore and this wiki will be deleted. Read more & discuss: https://github.com/airbrake/airbrake/issues/596
DEPRECATION WARNING: The information presented on this page is related to Airbrake v4 only. If you seek for information for Airbrake v5, please refer to our README!
Do you want Airbrake to report exceptions that happen inside a rake task?
require 'rake'
require 'airbrake/rake_handler' # require this if you don't have rails loaded
Airbrake.configure do |config|
# ...
config.rescue_rake_exceptions = true
config.ignore_rake << "ExceptionClassThatIWantToIgnore" # rake handler has separate set of
# ignored exceptions
end
Note: Airbrake must be loaded first to report exceptions. The easiest way to do this is to depend on the :environment
task:
task :do_something => :environment do
take_risks
maybe_raise_errors
end