diff options
author | Alanscut <wp_scut@163.com> | 2020-06-09 20:20:51 +0800 |
---|---|---|
committer | Alanscut <wp_scut@163.com> | 2020-06-09 20:51:46 +0800 |
commit | 86f82becdc7f69a1153f2a7400117bed09ebd8c9 (patch) | |
tree | d2624cabd8c0b756649e86b6747328e5dc197ded | |
parent | 9e4d423c22bedad6ffc260541ae587114dfed70a (diff) | |
download | python-json-patch-86f82becdc7f69a1153f2a7400117bed09ebd8c9.tar.gz |
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") |