class LHC::Rollbar < LHC::Interceptor include ActiveSupport::Configurable def after_response(response) return unless Object.const_defined?('Rollbar') request = response.request additional_params = request.options.fetch(:rollbar, {}) error = LHC::Error.find(response) 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 Rollbar.error( error, data ) end end