class TnS3FileUploader::HoneybadgerErrorReporter

Error reporter that uses Honeybadger service to report errors

Public Class Methods

new(api_key) click to toggle source

Configure honeybadger with provided api-key. Assumes api-key is not null

# File lib/tn_s3_file_uploader/error_reporting/honeybadger_error_reporter.rb, line 10
def initialize(api_key)
  # configure the hostname on EC2 instances
  hostname = Net::HTTP.get('169.254.169.254', '/latest/meta-data/hostname') rescue nil
  Honeybadger.configure do |config|
    config.api_key = api_key
    config.hostname = hostname if hostname # don't set
  end
end

Public Instance Methods

report_error(exception, options = {}) click to toggle source
# File lib/tn_s3_file_uploader/error_reporting/honeybadger_error_reporter.rb, line 19
def report_error(exception, options = {})
  Honeybadger.notify(exception, parameters: options)
end