-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
feat(assemble): Improve error messages for assemble endpoint #88905
base: master
Are you sure you want to change the base?
Conversation
return Response({"error": str(e).splitlines()[0]}, status=400) | ||
# Get the field from the path if available | ||
field = None | ||
if e.path: |
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.
This field contains a queue of the fields inside the schema that are matched.
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.
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
path = list(e.path) | ||
field = path.pop(0) if path else None | ||
|
||
return Response({"error": error_messages.get(field, e.message)}, status=400) |
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.
If 'field' is not a string (for example, if it's an integer from an array index), the lookup in error_messages may fail unexpectedly. Consider explicitly casting 'field' to a string for consistency: error_messages.get(str(field), e.message).
return Response({"error": error_messages.get(field, e.message)}, status=400) | |
return Response({"error": error_messages.get(str(field), e.message)}, status=400) |
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
This PR improves the error messages for the assemble endpoint.
Closes: #88068