无法通过轨道应用程序和耙子测试任务将异常数据发送到 Raygun.通过 Rails 控制台工作



我无法通过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 entry

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 在通过应用程序和耙子测试时工作,它没有。

通过 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

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

rake RAILS_ENV=production raygun:test

相关内容

  • 没有找到相关文章

最新更新