Rails exception notifier in rake tasks Rails exception notifier in rake tasks ruby-on-rails ruby-on-rails

Rails exception notifier in rake tasks


Create a task.rb file in config/initializers, which monkey patches Rake::Task#execute to include the functionality of exception_notify:

module Rake  class Task    alias :orig_execute :execute    def execute(args=nil)      orig_execute(args)    rescue Exception => exception      # Exception notification stuff    end  endend

Tested with Rails 3.0.12, Rake 0.9.2.2.