Airbrake::RakeHandler

Patch Rake::Application to handle errors with Airbrake

Public Class Methods

included(klass) click to toggle source
# File lib/airbrake/rake_handler.rb, line 3
def self.included(klass)
  klass.class_eval do
    include Rake087Methods unless defined?(Rake::VERSION) && Rake::VERSION >= '0.9.0'
    alias_method :display_error_message_without_airbrake, :display_error_message
    alias_method :display_error_message, :display_error_message_with_airbrake
  end
end

Public Instance Methods

display_error_message_with_airbrake(ex) click to toggle source
# File lib/airbrake/rake_handler.rb, line 11
def display_error_message_with_airbrake(ex)
  if Airbrake.sender && Airbrake.configuration &&
      (Airbrake.configuration.rescue_rake_exceptions ||
        (Airbrake.configuration.rescue_rake_exceptions===nil && !self.tty_output?))

    Airbrake.notify_or_ignore(ex, :component => reconstruct_command_line, :cgi_data => environment_info)
  end

  display_error_message_without_airbrake(ex)
end
environment_info() click to toggle source
# File lib/airbrake/rake_handler.rb, line 26
def environment_info
  ENV.reject do |k|
    Airbrake.configuration.rake_environment_filters.include? k
  end
end
reconstruct_command_line() click to toggle source
# File lib/airbrake/rake_handler.rb, line 22
def reconstruct_command_line
  "rake #{ARGV.join( ' ' )}"
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.