-
Notifications
You must be signed in to change notification settings - Fork 0
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
Fix Activity Stream Responses for Records that Never Existed – DEV-17363 #463
Fix Activity Stream Responses for Records that Never Existed – DEV-17363 #463
Conversation
…404 error response accordingly
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.
Hi Elana, thank you for this update, the changes look great, and I tested the functionality and it works as expected both for records that never existed as well as for records that previously did exist but have since been deleted.
In reviewing the output from the updated functionality, I noticed a minor related issue; It isn't something that we need to address here, but I think it is worth noting and discussing further, especially as this is now an open source project, as the clearer we can be throughout, the more user friendly the system becomes.
I noticed that the error response generated by the construct_error_response()
helper method, when called using the status_page_not_found
named-tuple, produces a "details" message string that is specific to its original use case, and reads "Page number out of bounds" in the JSON response:
{
"errors": [
{
"status": 404,
"title": "Page Not Found",
"detail": "Page number out of bounds"
}
]
}
While the wording of the "details" message is appropriate for some use cases, I think it could be improved upon for this use case in a future update by amending the message to broaden the use cases to which it is applicable or by providing a custom "details" message for this use case to ensure clarity for end users.
Hi Daniel! Thanks for taking a look at the PR! I completely agree about the error message being unclear, I went through a couple others in the errors file but none seem to be quite right. The closest in my opinion is
although it is not quite right as we are not checking a record in this case. Would it make sense to create a new error with similar language but for an entity rather than a record? We can also discuss further and make that update later. Thanks again! |
Hi Elana, thank you for the update, much better to deal with those integers as integers. I agree based on your notes that determining the best error response message can be left for a future update as none of the available options seem to fit here; I think it would be helpful to have the ability to override the "details" part of the error message in the call to Perhaps something like this could work (note the addition of the
We could then override the default message associated with a named-tuple, when calling
|
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 changes look great Elena, thank you!
Checked
total_pages
andcount
are0
in entity Activity Stream, and constructed a404 Not Found
error response accordingly.