LG-8514: PO Search: Handle unhandled timeout errors#7559
Conversation
…cations if there’s a failure
df2bc3a to
36b2c40
Compare
| rescue Faraday::ConnectionFailed => _error | ||
| nil | ||
| rescue => err | ||
| Rails.logger.warn(err) |
There was a problem hiding this comment.
I think it would be nice to log this in a more structured way, such as
Rails.logger.warn(exception_class: err.class, exception_message: err.message)
That way we can easily query these exception messages in cloudwatch later, eg make a table of exception classes by count. I don't think the default stringification of exceptions will make it easy on us if we're trying to sort through hundreds of error messages down the road
And then update the spec to check for a more specific error message instead of just that warn was called
There was a problem hiding this comment.
if we did that, I think we need to throw a {}.to_json around that, but otherwise yes, big fan of structured logs
There was a problem hiding this comment.
I'll add this as part of an upcoming ticket so we can make sure we're getting useful info.
🎫 Ticket
Link to the relevant ticket.
🛠 Summary of changes
USPS facilities search controller handles all exceptions by returning static pilot locations as a fallback. Logs errors to NewRelic. PR a temporary fallback to avoid entirely blocking a user from proofing.
Feedback from @tomas-nava:
Changes here address those concerns.
📜 Testing Plan
Provide a checklist of steps to confirm the changes.
👀 Screenshots
If relevant, include a screenshot or screen capture of the changes.
After: