无法通过rails app和rake测试任务向Raygun发送异常数据。通过Rails控制台工作

时间:2016-06-14 09:43:46

标签: ruby ruby-on-rails-3 raygun

我无法通过我们的暂存环境中的Rails App和Rake Test任务向Raygun发送异常数据。但是,通过Rails控制台发送异常数据。

Raygun.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

我在尝试佣金测试时收到的错误

$ 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

1 个答案:

答案 0 :(得分:1)

这可能看起来有点奇怪,但您可以尝试以稍微不同的顺序运行它,例如:

rake RAILS_ENV=production raygun:test