-
Notifications
You must be signed in to change notification settings - Fork 495
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
OAI-PMH error handling: meaningful errors in XML for verb processing #10205
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
src/main/java/edu/harvard/iq/dataverse/harvest/server/web/servlet/OAIServlet.java
Outdated
Show resolved
Hide resolved
dataProvider.handle(params) allows us to return the correct error.
This comment has been minimized.
This comment has been minimized.
src/main/java/edu/harvard/iq/dataverse/harvest/server/web/servlet/OAIServlet.java
Show resolved
Hide resolved
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.
Perfect!
This comment has been minimized.
This comment has been minimized.
@landreev from https://jenkins.dataverse.org/job/IQSS-Dataverse-Develop-PR/job/PR-10205/3/testReport/ we're seeing this: Any insight on this? I could swear I've seen this switch from noRecordsMatch to noSetHierarchy and back again, but that doesn't make sense. It should be one or the other, right? |
I just merged develop to kick off another Jenkins run to get another data point. I'm not sure if the error is flipping back and forth or not. Let's see. |
This comment has been minimized.
This comment has been minimized.
In 30e357b I changed the "no such set" test to expect noSetHierarchy rather than noRecordsMatch. |
This comment has been minimized.
This comment has been minimized.
If the set does not exist, then I would expect it to consistently return "no set hierarchy". I can't really think of a timing issue or anything like that, that would be causing a "no records match" intermittently. |
Wait, I was clearly wrong about the above. You know, I would go as far as to suggest to drop this test from the PR. Because |
This comment has been minimized.
This comment has been minimized.
... Although feel free to just modify the test, to expect either of the 2 error codes, "no sets" or "no records matching"; up to you. |
(sorry for the confusion; too many OAI PRs going on in parallel...) |
📦 Pushed preview images as
🚢 See on GHCR. Use by referencing with full name as printed above, mind the registry name. |
Tests are passing: https://jenkins.dataverse.org/job/IQSS-Dataverse-Develop-PR/job/PR-10205/7/testReport/edu.harvard.iq.dataverse.api/ @landreev there's probably no need for you to be assigned to this PR. Thanks for the feedback. I'll remove you. |
What this PR does / why we need it:
Currently, certain OAI requests, especially related to verbs or the absence of a verb, result in a 500 error and no meaningful information for the end user. Plus the poor sysadmin gets an ugly stacktrace in server.log.
As of this PR, we send XML responses with meaningful errors, like this:
/oai?foo=bar will show "No argument 'verb' found"
/oai?verb=foo&verb=bar will show "Verb must be singular, given: '[foo, bar]'"
Which issue(s) this PR closes:
Special notes for your reviewer:
In Slack I checked with @landreev and he's fine with the 200 response. "You have successfully queried the OAI server, and here’s your answer" even though the answer is "there was an error." This follows an established pattern set by (at least) "no set found", which I added a test for.
Due to how the xoai library is written, I have to return
<error code="badArgument">
rather than ` as the spec requires. ( http://www.openarchives.org/OAI/openarchivesprotocol.html#ErrorConditions says "Value of the verb argument is not a legal OAI-PMH verb, the verb argument is missing, or the verb argument is repeated."). However, Leonid and I are ok with deferring this as it requires work on the library side.I updated the docker compose file so I could test this.
Related:
Suggestions on how to test this:
Play around with variations on these:
Confirm I didn't break anything (HarvestingServerIT passes for me locally.)
Does this PR introduce a user interface change? If mockups are available, please link/include them here:
No.
Is there a release notes update needed for this change?:
Yes, included.
Additional documentation:
None.