-
Notifications
You must be signed in to change notification settings - Fork 377
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: add error code when searching for a record missing specific vector #4856
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #4856 +/- ##
===========================================
+ Coverage 90.94% 90.95% +0.01%
===========================================
Files 205 206 +1
Lines 10082 10098 +16
===========================================
+ Hits 9169 9185 +16
Misses 913 913
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
argilla-server/src/argilla_server/apis/v1/handlers/datasets/records.py
Outdated
Show resolved
Hide resolved
argilla-server/src/argilla_server/apis/v1/handlers/datasets/records.py
Outdated
Show resolved
Hide resolved
async def unprocessable_entity_error_exception_handler(request, exc): | ||
return JSONResponse( | ||
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY, | ||
content={"code": exc.code, "message": exc.message}, |
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.
One suggestion from @frascuchon is the possibility of returning a content
compatible with the API v0 errors:
content={"code": exc.code, "message": exc.message}, | |
content={ | |
"detail": { | |
"code": exc.code, | |
"params": { | |
"detail": exc.message | |
}, | |
}, | |
}, |
Add a comment as well noticing how we should return to the simple version once we remove API v0.
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.
After discussing it with @damianpumar we agreed into left this new more simple way of sending the error. Damián will manage this without any problem and in the future we can improve and remove the old API v0 errors structure.
The URL of the deployed environment for this PR is https://argilla-quickstart-pr-4856-ki24f765kq-no.a.run.app |
Description
An error is raised from backend when trying to find similar records when the vector is not defined for the used record. The error is fine but an additional attribute is needed on the front to support mapping that specific error to a translated message to the user.
This PR adds a new custom error using
message
andcode
attributes to be rendered as a JSON response.Closes #4655
Type of change
(Please delete options that are not relevant. Remember to title the PR according to the type of change)
How Has This Been Tested
(Please describe the tests that you ran to verify your changes. And ideally, reference
tests
)Checklist
Frontend handling