diff options
author | Stefan Kögl <stefan@skoegl.net> | 2020-06-22 14:41:08 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-22 14:41:08 +0200 |
commit | 625555ef5720d0060b7eeb477bfe5a693d4b25ef (patch) | |
tree | d2624cabd8c0b756649e86b6747328e5dc197ded | |
parent | 9e4d423c22bedad6ffc260541ae587114dfed70a (diff) | |
parent | 86f82becdc7f69a1153f2a7400117bed09ebd8c9 (diff) | |
download | python-json-patch-625555ef5720d0060b7eeb477bfe5a693d4b25ef.tar.gz |
Merge pull request #113 from Alanscut/issue-102
fix #102: optimize error handling
-rw-r--r-- | jsonpatch.py | 3 |
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") |