Skip to content

Commit 6632a05

Browse files
committed
throw error when replace encounters missing location
1 parent f577b7c commit 6632a05

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

JsonPatch/ReplaceOperationHandler.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ public void Process(PatchContext context, PatchOperation operation)
1818
return;
1919
}
2020

21-
if (!operation.Path.EvaluateAndGetParent(context.Source, out var target))
21+
if (!operation.Path.EvaluateAndGetParent(context.Source, out var target) ||
22+
!operation.Path.TryEvaluate(context.Source, out _))
2223
{
23-
context.Message = $"Target path `{operation.From}` could not be reached.";
24+
context.Message = $"Target path `{operation.Path}` could not be reached.";
2425
return;
2526
}
2627

0 commit comments

Comments
 (0)