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
EDS backend: support additional "missing record" cases #2324
Merged
demiankatz
merged 14 commits into
vufind-org:dev
from
he247:ULBF-376_catch_EDS-Backend_exception
Feb 17, 2022
Merged
Changes from 7 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
7d7efc8
ILS: Alma Healthcheck - getOfflineMode - Connection.php
he247 ccef0c7
Revise config text.
demiankatz c550de5
Merge branch 'vufind-org:dev' into dev
he247 f657489
Merge branch 'vufind-org:dev' into dev
he247 404651c
Merge branch 'vufind-org:dev' into dev
he247 9356d80
To prevent errors of the backend to interrupt the batch process of re…
he247 27764fc
corrected indent
he247 05190fe
fix spacing
he247 1af78ec
More specific Exception handling
he247 ec6a588
remove empty spaces
he247 89a551c
Wrong Test case
he247 a609704
Ordering by increasing number
he247 fd2db50
Adding one more error case
he247 067e137
Correct comments
he247 File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What exception is actually getting thrown here? Is there some more specific metric we can use to determine when it's appropriate to return an empty response (because, for example, the record really doesn't exist) and when something is more seriously wrong with the system?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also note that you're missing a space after
catch
if you want to conform to style guidelines, which is at least in part why the build is failing here. You should be able to auto-fix it withvendor/bin/phing php-cs-fixer
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Exception is thrown in line 293, so I think we would have to define the metric by ourself if I'm not mistaken.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought the exception thrown in line 293 was related to input validation -- that's saying that the provided ID is not in the expected format before even making an API call at all. How would invalid IDs end up on your lists to begin with? Or am I misunderstanding something? I thought the problem you were trying to solve here had to do with requesting IDs for records that were previously available but no longer exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, sorry then it's my fault. I tried to reproduce an error reported by a user but it seems I just didn't create a proper test case. :/
I will search for the id and check again what the exact exception will be.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Numeric order corrected. :)
Should we add the 133 as well? Even if it is rare, I have the philosophy that the overall system should not be blocked by exceptions (especially not if it is coming from outside like an API) but rather handle them in a proper way, if possible.
I mean, if there is an error on any API I want the user to be able to continue working as normal as possible and maybe only to receive a message that something went wrong in a specific part of the process. But if we have information locally I want the system to show what we have and not let an API exception block VuFind in a broader range than it should.
For example in the user lists, I'm showing the user that the record is not available in the database any more and give all the information stored in the DB, with a link to a new search, so that the user could get alternative sources if available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, both of you! I don't think @cwolfebsco needs to bother anyone else -- the reference he shared is extremely helpful and I think answers the necessary questions. @he247, I agree that adding 133 is probably worthwhile, even if it's rare. It might also be worth using comments to annotate the codes in the switch statement with the descriptions shared above and/or including a link to the referenced documentation, just so it's more clear exactly what everything means if we review this code again in future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great I'll add the comments and 133. Then I'll open the review again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @he247 -- I'm leaving on vacation right now, but I'll merge this as soon as I can. :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@demiankatz enjoy your holiday! :) Thank you for your help, as always!