如何输出更多信息以记录此错误?

时间:2019-05-06 20:38:28

标签: ruby-on-rails

我已经接管了一个ROR项目。新手。我收到此错误,但是我无法确定原因或原因。

如果您不看最后的救援,它会显示出击中的位置,但是我找不到一种方法来追溯使用哪种方法获取很多参数。

错误:正在通过以下方法记录

uncaught wrong number of arguments (given 1, expected 0) exception while handling connection: wrong number of arguments (given 1, expected 0)

代码:

begin
    ar = ambRequest.request_amb(
      current_user,
      params[:pickup_address],
      plat,
      plng,
      round_trip,
      dlat,
      dlng,
      params[:dropoff_address],
      type,
      params[:notes],
      md,
      params[:payment_token],
      request.ip,
      params[:notify_phone],
      params[:notify_email],
      params[:special_payment_method],
      false,
      nil,
      params[:estimated_time]
    )
    {'_id' => ar.id.to_s, 'status' => ar.status, 'user_id' => ar.user_id}
  rescue InvalidPaymentToken
    {'_id' => nil, 'status' => "Invalid Payment Token", 'user_id' => nil}
  rescue NoPricingData
    {'_id' => nil, 'status' => "No Pricing Information", 'user_id' => nil}
  rescue RequestFailed
    {'_id' => nil, 'status' => 'FAILED', 'user_id' => ar.user_id}
  rescue PaymentFailure
    {'_id' => nil, 'status' => "Credit card error. There may be a problem with our servers.", 'user_id' => nil}
  rescue UnknownPaymentMethod
    {'_id' => nil, 'status' => "Unknown Special Payment Method. Valid types are [#{ambRequest::VALID_SPECIAL_PAYMENT_METHODS.join(',')}]", 'user_id' => nil}
  rescue ExclusiveAlreadyUsed
    {'_id' => nil, 'status' => 'Exclusive token already used', 'user_id' => ar.user_id}
  rescue => e
    u = User.root_user || current_user
    LogEntry.record(u, "uncaught #{e} exception while handling connection: #{e.message}", LogEntry::ADMIN)
    {'_id' => nil, 'status' => 'FAILED', 'user_id' => current_user.id.to_s}
  end

更新=====

这是堆栈跟踪。不知道问题出在哪里。是最后一个方法调用吗?

backtrace
/app/vendor/bundle/ruby/2.4.0/gems/sendgrid-ruby-5.3.0/lib/sendgrid/helpers/settings/settings.rb:13:in `initialize'\n
/app/vendor/bundle/ruby/2.4.0/gems/mongoid-5.0.2/lib/mongoid/persistable/creatable.rb:148:in `new'\n
/app/vendor/bundle/ruby/2.4.0/gems/mongoid-5.0.2/lib/mongoid/persistable/creatable.rb:148:in `block in create'\n
/app/vendor/bundle/ruby/2.4.0/gems/mongoid-5.0.2/lib/mongoid/threaded/lifecycle.rb:161:in `_creating'\n
/app/vendor/bundle/ruby/2.4.0/gems/mongoid-5.0.2/lib/mongoid/persistable/creatable.rb:144:in `create'\n
/app/app/models/settings.rb:17:in `singleton'\n
/app/app/models/settings.rb:23:in `use_kue?'\n
/app/app/models/amb_request.rb:513:in `request_amb'\n/app/lib/api_v1/ambs.rb:197

更新日期:

class Settings


include Mongoid::Document
  field :use_kue, :type => Boolean, :default => false
  field :api_url, :type => String
  field :api_key, :type => String
  field :staging_url, :type => String
  field :staging_key, :type => String
  field :are_you_awake_interval_minutes, :type => Integer
  field :are_you_awake_duration_seconds, :type => Integer
  field :online, :type => Boolean, :default => false
  field :online_reason, :type => String
  field :blocked_credit_cards, :type => Array

  def self.singleton
    s = Settings.first
    if s.nil?
      s = Settings.create
    end
    s
  end

  def self.use_kue?
    s = Settings.singleton
    s.use_kue
  end
end

0 个答案:

没有答案