Sha256: b68f2f4a8efb9fc8cbb80611e6fa70f980124986980d6cbb809b21e88da244fd

Contents?: true

Size: 849 Bytes

Versions: 2

Compression:

Stored size: 849 Bytes

Contents

module Bugsnag
  module Delivery
    class Synchronous
      HEADERS = {"Content-Type" => "application/json"}
      TIMEOUT = 5

      class << self
        def deliver(url, body)
          begin
            response = HTTParty.post(url, {:body => body, :headers => HEADERS, :timeout => TIMEOUT})
            Bugsnag.debug("Notification to #{url} finished, response was #{response.code}, payload was #{body}")
          rescue StandardError => e
            # KLUDGE: Since we don't re-raise http exceptions, this breaks rspec
            raise if e.class.to_s == "RSpec::Expectations::ExpectationNotMetError"

            Bugsnag.warn("Notification to #{url} failed, #{e.inspect}")
            Bugsnag.warn(e.backtrace)
          end
        end
      end
    end
  end
end

Bugsnag::Delivery.register(:synchronous, Bugsnag::Delivery::Synchronous)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bugsnag-2.6.1 lib/bugsnag/delivery/synchronous.rb
bugsnag-2.6.0 lib/bugsnag/delivery/synchronous.rb