gravity9-tech / json-patch-path

An RFC 6902 (JSON Patch) and reverse, plus RFC 7386 (JSON Merge Patch), implementation in Java using Jackson (2.x)
Other
11 stars 1 forks source link

Add context to JsonPatchException #45

Closed BartekGravity closed 1 year ago

BartekGravity commented 1 year ago

Issue copied from: https://github.com/java-json-tools/json-patch/issues/84

I get an JsonPatchException "no such path in target JSON document". There is no context at all regarding what the path is that's missing. Can you please add that?

e.g.. In RemoveOperation, can the path be added to the exception message?

if (path.isEmpty())
        return MissingNode.getInstance();
if (path.path(node).isMissingNode())
        throw new JsonPatchException(BUNDLE.getMessage("jsonPatch.noSuchPath"));