Sha256: f633b75eb2ac3f2fbd6ecb6098b3649b0b80b50962747c4872827ebbf3790d6a
Contents?: true
Size: 1.08 KB
Versions: 7
Compression:
Stored size: 1.08 KB
Contents
# frozen_string_literal: true require 'core_ext/hash/deep_transform_values' class DHC::Rollbar < DHC::Interceptor include ActiveSupport::Configurable include DHC::FixInvalidEncodingConcern def after_response return unless Object.const_defined?('Rollbar') return if response.success? request = response.request additional_params = request.options.fetch(:rollbar, {}) data = { response: { body: response.body, code: response.code, headers: response.headers, time: response.time, timeout?: response.timeout? }, request: { url: request.url, method: request.method, headers: request.headers, params: request.params } }.merge additional_params begin Rollbar.warning("Status: #{response.code} URL: #{request.url}", data) rescue Encoding::UndefinedConversionError sanitized_data = data.deep_transform_values { |value| self.class.fix_invalid_encoding(value) } Rollbar.warning("Status: #{response.code} URL: #{request.url}", sanitized_data) end end end
Version data entries
7 entries across 7 versions & 1 rubygems