Skip to content

Conversation

@MiguelSavignano
Copy link

@MiguelSavignano MiguelSavignano commented Jan 29, 2022

#12

Create a new errors class

PatchInvalidOperationError
PatchMissingTargetObjectError
PatchTestNotEqualError
PatchMissingKeyError

Example:

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

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