aspnet / JsonPatch

[Archived] JSON PATCH library. Project moved to https://github.com/aspnet/AspNetCore
Apache License 2.0
103 stars 48 forks source link

Performing Test Operation with Operation<T> on a JsonPatchDocument<T> does not throw #94

Closed patrick-hampton-avalara closed 7 years ago

patrick-hampton-avalara commented 7 years ago

The implementation of Operation differs from Operation in that Operation throws a JsonPatchException when Test is used. This type of exception is caught and "reported", then the ApplyTo is short circuited but the method returns. In this scenario the caller has no way of knowing that anything failed.
Recommend changing the exception type thrown by Operation.ApplyTo to be consistent with Operation. Alternatively (or in addition to) the catch in JsonPatchDocument should rethrow the exception that it caught so the caller is always aware of any exception that occurred.

Eilon commented 7 years ago

If we implement the test operation per https://github.com/aspnet/JsonPatch/issues/1, this issue would go away.

jbagga commented 7 years ago

Test operation is now supported as part of #1. Please feel free to reopen this if you run into a problem.