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

Improve JsonPatch exceptions #53

Closed
jakobw opened this issue Oct 13, 2022 · 1 comment · Fixed by #57
Closed

Improve JsonPatch exceptions #53

jakobw opened this issue Oct 13, 2022 · 1 comment · Fixed by #57

Comments

@jakobw
Copy link
Contributor

jakobw commented Oct 13, 2022

Hi! 👋

As mentioned in #49 we (@wmde) are using json-diff in the context of a PATCH endpoint in our REST API. We realized that some changes to the exceptions thrown by JsonPatch would allow us to provide more helpful error responses to our users.

The concrete improvements we're thinking of are:

  1. More exception types for different types of errors (similar to Throw different exception for failed test op #49), e.g. some sort of MissingFieldException and InvalidOperationException thrown by JsonPatch::import() to tell the two error cases apart
  2. Include details about the error in the exception if possible. For most (all?) error cases would be the failed operation (related to Enhancement: Include failed operation in Exception #45), but potentially also additional information, e.g. the actual value that caused a test operation to fail.

If this generally sound useful, we'd be happy to submit a PR.

@vearutop
Copy link
Member

Hi, this definitely sounds like an improvement and I'd be happy to accept a PR for that. 👍

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 a pull request may close this issue.

2 participants