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

chore(api/diff): improve error message when json parsing objects #3536

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

iainsproat
Copy link
Contributor

@iainsproat iainsproat commented Nov 21, 2024

Description & motivation

The fact that the objects parameter of the diff upload and download is meant to be JSON stringified representation of a list is often missed by developers (Speckle and non-Speckle, it's really not an obvious API design choice). It is currently difficult to debug because the error message is not helpful.

This PR wraps the JSON parsing error and provides additional context to help make the issue clearer and the problem easier to resolve.

It also ensures the correct status code is returned to the user.

Changes:

To-do before merge:

Screenshots:

Validation of changes:

(NB, the stack trace is only displayed because this is running in development mode)

Screenshot 2024-11-21 at 12 29 25

Checklist:

  • My pull request follows the guidelines in the Contributing guide?
  • My pull request does not duplicate any other open Pull Requests for the same update/change?
  • My commits are related to the pull request and do not amend unrelated code or documentation.
  • My code follows a similar style to existing code.
  • I have added appropriate tests.
  • I have updated or added relevant documentation.

References

@iainsproat iainsproat marked this pull request as ready for review November 21, 2024 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant