summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Kögl <stefan@skoegl.net>2020-06-22 14:41:08 +0200
committerGitHub <noreply@github.com>2020-06-22 14:41:08 +0200
commit625555ef5720d0060b7eeb477bfe5a693d4b25ef (patch)
treed2624cabd8c0b756649e86b6747328e5dc197ded
parent9e4d423c22bedad6ffc260541ae587114dfed70a (diff)
parent86f82becdc7f69a1153f2a7400117bed09ebd8c9 (diff)
downloadpython-json-patch-625555ef5720d0060b7eeb477bfe5a693d4b25ef.tar.gz
Merge pull request #113 from Alanscut/issue-102
fix #102: optimize error handling
-rw-r--r--jsonpatch.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/jsonpatch.py b/jsonpatch.py
index ca22e34..e042ce2 100644
--- a/jsonpatch.py
+++ b/jsonpatch.py
@@ -473,6 +473,9 @@ class ReplaceOperation(PatchOperation):
if part is None:
return value
+ if part == "-":
+ raise InvalidJsonPatch("'path' with '-' can't be applied to 'replace' operation")
+
if isinstance(subobj, MutableSequence):
if part >= len(subobj) or part < 0:
raise JsonPatchConflict("can't replace outside of list")