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

IQSS/10812 - Add details to error messages #10813

Conversation

qqmyers
Copy link
Member

@qqmyers qqmyers commented Aug 29, 2024

What this PR does / why we need it: This PR incorporates any messages added to a BadRequestException when it is thrown into the final message the API user sees. If there is no message, the error response is generic as before.

Which issue(s) this PR closes:

Closes #10812

Special notes for your reviewer: Feel free to improve the message

Suggestions on how to test this: Make a call such as
curl -H 'X-Dataverse-key:e6affd89-03f5-4b61-8ed6-d9af41228df2' -X PUT -d '{"https://dataverse.org/schema/core#fileTermsOfAccess":{"https://dataverse.org/schema/core#dataAccessPlace":"OTR"}}' -H "Content-type:application/ld+json" -H "Accept:application/ld+json" http://localhost:8080/api/datasets/10345/metadata twice on a dataset (once to add the value, and the second time to trigger an error ("Can't append to a single-value field that already has a value: https://dataverse.org/schema/core#dataAccessPlace") - and verify that the test above is part of the API 400 response you get. (FWIW: If you want the call to succeed, add ?replace=true to the call).

Does this PR introduce a user interface change? If mockups are available, please link/include them here:

Is there a release notes update needed for this change?: - It's a change to the "message" included in the error responses for some API calls (and we already have messages that change due to i18n), so I don't think it's needed, but I'd be happy to have a "Error messages for some API calls have more detail" as a release note and/or to have it mentioned in a change log.

Additional documentation:

@qqmyers qqmyers added GDCC: DANS related to GDCC work for DANS GDCC: QDR of interest to QDR Size: 3 A percentage of a sprint. 2.1 hours. labels Aug 29, 2024
Copy link
Member

@pdurbin pdurbin left a comment

Choose a reason for hiding this comment

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

I didn't test this but it seems like a reasonable fix. Approved.

@stevenwinship stevenwinship self-assigned this Sep 4, 2024
@stevenwinship stevenwinship merged commit 05962ef into IQSS:develop Sep 4, 2024
10 of 11 checks passed
@stevenwinship stevenwinship removed their assignment Sep 4, 2024
@pdurbin pdurbin added this to the 6.4 milestone Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GDCC: DANS related to GDCC work for DANS GDCC: QDR of interest to QDR Size: 3 A percentage of a sprint. 2.1 hours.
Projects
Status: Done 🧹
3 participants