Module: Appsignal::Integrations::RakeIntegration

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

Instance Method Summary collapse

Instance Method Details

#execute(*args) ⇒ Object



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

def execute(*args)
  super
rescue Exception => error # rubocop:disable Lint/RescueException
  # Format given arguments and cast to hash if possible
  params, _ = args
  params = params.to_hash if params.respond_to?(:to_hash)

  transaction = Appsignal::Transaction.create(
    SecureRandom.uuid,
    Appsignal::Transaction::BACKGROUND_JOB,
    Appsignal::Transaction::GenericRequest.new(
      :params => params
    )
  )
  transaction.set_action(name)
  transaction.set_error(error)
  transaction.complete
  Appsignal.stop("rake")
  raise error
end