Module: Bugsnag::RakeTask

Defined in:
lib/bugsnag/integrations/rake.rb

Constant Summary collapse

FRAMEWORK_ATTRIBUTES =
{
  framework: 'Rake'
}

Instance Method Summary collapse

Instance Method Details

#execute(args = nil) ⇒ Object

Executes the rake task with Bugsnag setup with contextual data.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/bugsnag/integrations/rake.rb', line 16

def execute(args = nil)
  Bugsnag.configuration.detected_app_type = "rake"

  old_task = Bugsnag.configuration.request_data[:bugsnag_running_task]
  Bugsnag.configuration.set_request_data :bugsnag_running_task, self
  Bugsnag.configuration.runtime_versions["rake"] = ::Rake::VERSION

  super
rescue Exception => ex
  Bugsnag.notify(ex, true) do |report|
    report.severity = "error"
    report.severity_reason = {
      type: Bugsnag::Report::UNHANDLED_EXCEPTION_MIDDLEWARE,
      attributes: FRAMEWORK_ATTRIBUTES
    }
  end
  raise
ensure
  Bugsnag.configuration.set_request_data :bugsnag_running_task, old_task
end