Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle Overdrive refresh_patron_access_token failues (PP-1964) #2188

Merged
merged 1 commit into from
Nov 26, 2024

Conversation

jonathangreen
Copy link
Member

Description

Previously in refresh_patron_access_token we were only handling the cases for status_code 200 and 400. Everything else would just pass through the function without doing anything.

After this update any 2xx status code will be counted as a success, and any other status code will fail patron auth, log a useful error message and return a ProblemDetail document to the client.

I added a test case with a real API failure error from Overdrive, and added another test case to make sure we correctly handle unexpected responses.

Motivation and Context

We were seeing unhandled exceptions in Exception in web app: Something's wrong with the patron OAuth Bearer Token on our webservers reasonably frequently. This appears to be happening when Overdrive is not happy with a patrons auth for some reason.

How Has This Been Tested?

  • Tested locally

Checklist

  • I have updated the documentation accordingly.
  • All new and existing tests passed.

@jonathangreen jonathangreen requested a review from a team November 25, 2024 15:22
@jonathangreen jonathangreen changed the title Handle Overdrive refresh_patron_access_token failues Handle Overdrive refresh_patron_access_token failues (PP-1964) Nov 25, 2024
Copy link

codecov bot commented Nov 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.07%. Comparing base (8d10cab) to head (30e3c3c).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2188      +/-   ##
==========================================
+ Coverage   91.05%   91.07%   +0.02%     
==========================================
  Files         363      363              
  Lines       41218    41220       +2     
  Branches     8847     8843       -4     
==========================================
+ Hits        37530    37542      +12     
+ Misses       2417     2408       -9     
+ Partials     1271     1270       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jonathangreen jonathangreen added the bug Something isn't working label Nov 25, 2024
Copy link
Contributor

@tdilauro tdilauro left a comment

Choose a reason for hiding this comment

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

🎉

@jonathangreen jonathangreen merged commit bf80d69 into main Nov 26, 2024
21 checks passed
@jonathangreen jonathangreen deleted the bugfix/overdrive-patron-auth-exception branch November 26, 2024 00:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants