Skip to content

LG-8886: Catch and log network error when renewing USPS API auth token#9030

Merged
NavaTim merged 2 commits intomainfrom
lg-8886/handle-usps-token-refresh-network-errors
Aug 21, 2023
Merged

LG-8886: Catch and log network error when renewing USPS API auth token#9030
NavaTim merged 2 commits intomainfrom
lg-8886/handle-usps-token-refresh-network-errors

Conversation

@NavaTim
Copy link
Contributor

@NavaTim NavaTim commented Aug 17, 2023

🎫 Ticket

🛠 Summary of changes

  • Catch and log Faraday::TimeoutError and Faraday::ConnectionFailed when renewing USPS API auth token
    • This prevents these relatively common errors from bubbling up in a way that may trigger other alarms.

📜 Testing Plan

  • Check that your local stack has the following flag enabled:
    • usps_mock_fallback
  • Create a method UspsInPersonProofing::Mock::Proofer.retrieve_token! that throws Faraday::TimeoutError.new("test message")
  • Run USPS token renewal job
    •  rails c
    •  UspsAuthTokenRefreshJob.perform_now
  • Check that log/events.log includes the event UspsAuthTokenRefreshJob: Network error with the following fields:
    • exception_class = Faraday::TimeoutError
    • exception_message = test message

changelog: Internal, In-Person Proofing, Catch and log network error when renewing USPS API auth token
@NavaTim NavaTim requested review from a team and sheldon-b August 17, 2023 19:32
Copy link
Contributor

@tomas-nava tomas-nava left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approve!

@NavaTim NavaTim merged commit 43835ba into main Aug 21, 2023
@NavaTim NavaTim deleted the lg-8886/handle-usps-token-refresh-network-errors branch August 21, 2023 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants