json-patch icon indicating copy to clipboard operation
json-patch copied to clipboard

Descriptive errors

Open MiguelSavignano opened this issue 4 years ago • 0 comments

With the invalid operation, missing document key or missing object key the error is the same JSON::PatchError

Example: Missing document key path

operations = [{"op": "replace", "value": "BAZZ"}]
item = {foo: "bazz"}
JSON::Patch.new(item, operations).call
# => JSON::PatchError

Invalid operation replaces

operations = [{"op": "replaces", path: "/foo", "value": "BAZZ"}]
item = {foo: "bazz"}
JSON::Patch.new(item, operations).call
# => JSON::PatchError

MiguelSavignano avatar Jan 28 '22 22:01 MiguelSavignano