Class: Bugsnag::Delivery::Synchronous

Inherits:
Object
  • Object
show all
Defined in:
lib/bugsnag/delivery/synchronous.rb

Direct Known Subclasses

ThreadQueue

Class Method Summary collapse

Class Method Details

.deliver(url, body, configuration, options = {}) ⇒ Object

Attempts to deliver a payload to the given endpoint synchronously.


10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/bugsnag/delivery/synchronous.rb', line 10

def deliver(url, body, configuration, options={})
  begin
    response = request(url, body, configuration, options)
    configuration.debug("Request to #{url} completed, status: #{response.code}")
    if response.code[0] != "2"
      configuration.warn("Notifications to #{url} was reported unsuccessful with code #{response.code}")
    end
  rescue StandardError => e
    # KLUDGE: Since we don't re-raise http exceptions, this breaks rspec
    raise if e.class.to_s == "RSpec::Expectations::ExpectationNotMetError"

    configuration.error("Unable to send information to Bugsnag (#{url}), #{e.inspect}")
    configuration.error(e.backtrace)
  end
end