Module: Traject::SolrJsonHttpxWriter::HttpxRaiseErrorPlugin::InstanceMethods

Defined in:
lib/traject/solr_json_httpx_writer.rb

Instance Method Summary collapse

Instance Method Details

#fetch_responseObject



483
484
485
486
487
488
# File 'lib/traject/solr_json_httpx_writer.rb', line 483

def fetch_response(...)
  super.tap do |response|
    # we don't want to raise on 4xx and 5xx responses, just actual errors with no response!
    response.raise_for_status if response&.error && !response&.error.kind_of?(HTTPX::HTTPError)
  end
end

#send_requests(*requests) ⇒ Object



490
491
492
493
494
495
# File 'lib/traject/solr_json_httpx_writer.rb', line 490

def send_requests(*requests)
  if requests.length > 1
    raise ArgumentError.new("HttpxRaiseErrorPlugin only supports one request arg at a time, got #{requests.length}")
  end
  super
end