0

我无法通过 Rails 应用程序和我们暂存环境中的 Rake 测试任务向 Raygun 发送异常数据。不过,异常数据的发送是通过 Rails 控制台进行的。

雷根.rb

Raygun.setup do |config|
  config.api_key = [Key]
  config.filterparameters = Rails.application.config.filterparameters
  config.enable_reporting = !Rails.env.development?
end

Gemfile.lock raygun 条目

raygun4ruby (1.1.9)

httparty (~> 0.11)
json
rack

我尝试 rake 测试时遇到的错误

$ RAILS_ENV=production rake raygun:test

Oh-oh, something went wrong - double check your API key

API Key - [FIltered])
rake aborted!

TypeError: no implicit conversion of HTTParty::Response into String

/var/lib/gems/2.3.0/gems/raygun4ruby-1.1.9/lib/raygun/testable.rb:17:in `rescue in tracktestexception'

/var/lib/gems/2.3.0/gems/raygun4ruby-1.1.9/lib/raygun/testable.rb:8:in `tracktestexception'

/var/lib/gems/2.3.0/gems/raygun4ruby-1.1.9/lib/tasks/raygun.tasks:5:in `block (2 levels) in

Raygun::ItWorksException: Woohoo! Your Raygun<->Ruby connection is set up correctly

/var/lib/gems/2.3.0/gems/raygun4ruby-1.1.9/lib/raygun/testable.rb:9:in `tracktestexception'

/var/lib/gems/2.3.0/gems/raygun4ruby-1.1.9/lib/tasks/raygun.tasks:5:in `block (2 levels) in

Tasks: TOP => raygun:test

(See full trace by running task with --trace)

我们将 AWS 用于我们的暂存环境。令我惊讶的是,Rails C 在通过应用程序和 rake 测试时可以正常工作,但它却不能。

通过 Rails 控制台完成时

irb(main):003:0> class ItWorksException < StandardError; end
=> nil
irb(main):004:0> e = ItWorksException.new("Woohoo! Your Raygun<->Ruby connection is set up correctly")
=> #
irb(main):005:0> response = Raygun.track_exception(e)

[Raygun] Tracking Exception...
=> #
irb(main):006:0> response.success?
=> true
4

1 回答 1

1

This may seem a bit odd, but can you try running it in a slightly different order like:

rake RAILS_ENV=production raygun:test

于 2016-07-22T18:40:35.957 回答