Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi again 👋
@Silvan-WMDE, @outdooracorn and I worked on the aforementioned improvements to
JsonPatch
errors. Here is what we did:JsonPatch::import()
now throws aMissingFieldException
in case of a missing field. The exception contains the name of the missing field and the operation.JsonPatch::import()
now throws aUnknownOperationException
in case of an unknown operation type. The exception contains the operation.PatchTestOperationFailedException
now contains the failed operation and the value that caused the test operation to fail.JsonPatch::apply()
now throws aPathException
in case anything is wrong with the path in a "path" or "from" field of an operation. The exception contains the name of the problematic field ("path" or "from") and the operation.JsonPointer
now always throwsJsonPointerException
instead of a genericException
.This last point isn't really something we planned on doing, but it helped us in our implementation of the
PathException
case above. We also considered an alternative approach in https://github.com/wmde/json-diff/pull/4/files that didn't require the introduction of aJsonPointerException
. We'd be curious to hear your thoughts on it, or alternative ideas!The changes are fairly well split up into commits. Let me know if that works, or if you'd rather have the changes submitted individually or sliced differently.
Thanks! :)
Fixes #53.