Class: Rake::Task

Inherits:
Object
  • Object
show all
Defined in:
lib/bugsnag/rake.rb

Instance Method Summary collapse

Instance Method Details

#execute_with_bugsnag(args = nil) ⇒ Object Also known as: execute



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/bugsnag/rake.rb', line 7

def execute_with_bugsnag(args=nil)
  Bugsnag.configuration.app_type ||= "rake"
  old_task = Bugsnag.configuration.request_data[:bugsnag_running_task]
  Bugsnag.set_request_data :bugsnag_running_task, self

  execute_without_bugsnag(args)

rescue Exception => ex
  Bugsnag.auto_notify(ex, {
    :severity_reason => {
      :type => Bugsnag::Notification::UNHANDLED_EXCEPTION_MIDDLEWARE,
      :attributes => {
        :framework => "Rake"
      }
    }
  })
  raise
ensure
  Bugsnag.set_request_data :bugsnag_running_task, old_task
end