Sha256: 3d0ebebe114d8fca72a86c458b06a91e4bfb974f74a50709fda699f1ecd34b8d

Contents?: true

Size: 675 Bytes

Versions: 5

Compression:

Stored size: 675 Bytes

Contents

class StandardError
  # Shortcut for .send(:notify_or_ignore, *e.airbrake_args)
  def airbrake_args
    [self, parameters: airbrake_params]
  end

  # Default is to report all instance variables to Airbrake.
  def airbrake_params
    params = {}

    begin
      instance_variables.each do |name|
        params[name.to_s] = instance_variable_get(name).try(:as_json)
      end
    rescue StandardError => e
      # In development or test, complain if this goes wrong.
      # In production, don't crash, omitting params instead.
      # Dear user: If your errors stop showing parameters, this may be why.
      raise e if Rails.env.development?
    end

    params
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
airbrake-extended-0.0.8 lib/patches/standard_error.rb
airbrake-extended-0.0.7 lib/patches/standard_error.rb
airbrake-extended-0.0.5 lib/patches/standard_error.rb
airbrake-extended-0.0.4 lib/patches/standard_error.rb
airbrake-extended-0.0.3 lib/patches/standard_error.rb