Class: Airbrake::FaradaySender
- Inherits:
-
Object
- Object
- Airbrake::FaradaySender
- Extended by:
- Forwardable
- Defined in:
- lib/airbrake/faraday_sender.rb,
lib/airbrake-faraday_sender/version.rb
Defined Under Namespace
Modules: Version
Class Attribute Summary collapse
-
.faraday_middleware ⇒ Object
Returns the value of attribute faraday_middleware.
Instance Method Summary collapse
-
#initialize(configuration) ⇒ FaradaySender
constructor
A new instance of FaradaySender.
-
#send_to_airbrake(data) ⇒ Object
Override the send to airbrake method.
Constructor Details
#initialize(configuration) ⇒ FaradaySender
Returns a new instance of FaradaySender.
14 15 16 |
# File 'lib/airbrake/faraday_sender.rb', line 14 def initialize(configuration) @configuration = configuration end |
Class Attribute Details
.faraday_middleware ⇒ Object
Returns the value of attribute faraday_middleware.
11 12 13 |
# File 'lib/airbrake/faraday_sender.rb', line 11 def faraday_middleware @faraday_middleware end |
Instance Method Details
#send_to_airbrake(data) ⇒ Object
Override the send to airbrake method
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/airbrake/faraday_sender.rb', line 19 def send_to_airbrake(data) log :debug, "Sending request to #{url.to_s}:\n#{data}" response = begin log :info, "Starting post::: #{url.path}" connection.post(url.path, data) do |req| req.headers = Airbrake::HEADERS end rescue Faraday::Error::ClientError => e log :error, "Error contacting Airbrake server: #{e.}" return end log :info, "Success: #{response.class}", response if response.respond_to?(:body) error_id = response.body.match(%r{<error-id[^>]*>(.*?)</error-id>}) error_id[1] if error_id end end |