我们在整个代码库中都使用了 airbrake,除了不从 Rails 层次结构继承的自定义类(即 ActiveRecord)外,它工作得很好。
一些代码:
class Offer
def counter(amount, qty=1)
begin
offers_response = viyet_mage_rest_client.counter_offer(@id.to_i, amount, qty.to_i)
rescue => e
notify_airbrake(e)
offers_response = []
end
end
end
在空气制动中,我们看到:
NoMethodError: undefined method `notify_airbrake' for Offer:Class
作为错误。我想要实际的错误而不是报告错误的错误!
我们的 airbrake.rb 文件:
if Rails.env.production? || Rails.env.staging?
Airbrake.configure do |config|
config.api_key = Settings.airbrake.api_key
config.secure = true
end
end
任何帮助,将不胜感激!