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

Improve lending error handling #8371

Merged
merged 8 commits into from
Nov 3, 2023
Merged

Conversation

mekarpeles
Copy link
Member

@mekarpeles mekarpeles commented Oct 5, 2023

Closes #8372. Loosely related to #3429, we think we're seeing an uptick of lending error exception cases perhaps related to system limit. We want to add more specific reporting (e.g. response 429 instead of generic 400 or 401) so we know internally where these error cases are coming from and how to deal with them gracefully for patrons.

EDIT: I think we may have converged on 409 HTTP Response: Conflict or 429.

This PR likely depends on changes being made internally within petabox, perhaps near:
https://git.archive.org/ia/petabox/-/blob/master/www/common/Lending.inc#L111-114

Which also pertains to https://git.archive.org/ia/petabox/-/blob/master/www/common/Lending/BookLoanService.inc#L525-534 and https://git.archive.org/ia/petabox/-/blob/master/www/common/Lending/BookLoanService.inc#L570-586

Technical Notes

With this PR, when a 400 or 409 is encountered, we won't perform the borrow and will redirect the patron to archive.org (which isn't great -- they'll re-attempt to borrow and then see a indescript archive.org error -- but this is better than Open Library's stacktrace / generic see: 123871281.html page)

Stakeholders

@seabelis @judec @bfalling

@mekarpeles mekarpeles added the Priority: 1 Do this week, receiving emails, time sensitive, . [managed] label Oct 17, 2023
@mekarpeles mekarpeles marked this pull request as ready for review October 18, 2023 19:36
@mekarpeles mekarpeles changed the title WIP improve lending error handling Improve lending error handling Oct 19, 2023
@mekarpeles mekarpeles added the On testing.openlibrary.org This PR has been deployed to testing.openlibrary.org for testing label Oct 23, 2023
@mekarpeles
Copy link
Member Author

@bfalling and I were discussing what to do if lending fails for a title. We may want to redirect to the Open Library book page and show a toast message

@mekarpeles mekarpeles added the Needs: Community Discussion This issue is to be brought up in the next community call. [managed] label Oct 27, 2023
@mekarpeles mekarpeles assigned jimchamp and unassigned cdrini Oct 30, 2023
Copy link
Collaborator

@jimchamp jimchamp left a comment

Choose a reason for hiding this comment

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

Looks good to me. Will add the toast messages in a separate branch.

@jimchamp jimchamp merged commit 61d1f85 into master Nov 3, 2023
3 checks passed
@jimchamp jimchamp deleted the improve-lending-error-handling branch November 3, 2023 19:12
@jimchamp jimchamp removed the On testing.openlibrary.org This PR has been deployed to testing.openlibrary.org for testing label Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Community Discussion This issue is to be brought up in the next community call. [managed] Priority: 1 Do this week, receiving emails, time sensitive, . [managed]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handle Upstream Lending & API exceptions
3 participants