pulibrary / orangelight

PUL Blacklight Project (Ruby 3.1.0, Rails 7.1.4)
21 stars 7 forks source link

load_location method occassionally encounters error responses, which it does not handle well #3492

Open sandbergja opened 1 year ago

sandbergja commented 1 year ago

Expected behavior

Currently, Request::load_location makes a request to bibdata for data about a holding_location. When bibdata responds with an error, it should either retry or handle the error better.

Actual behavior

It throws an error:

JSON::ParserError: lexical error: invalid char in json text.
                                       <!DOCTYPE html> <html lang="en"
                     (right here) ------^

Steps to replicate

You would probably need to mock this call in an rspec test.

Impact of this bug

Unclear. It doesn't happen too often.

Honeybadger link and code snippet, if applicable

https://app.honeybadger.io/projects/54399/faults/94945688/

    def parse_json(data)
      JSON.parse(data)
    end

Implementation notes, if any

christinach commented 1 year ago

The html is either from the load balancer or from the bibdata application.