diff options
author | Stefan Kögl <stefan@skoegl.net> | 2012-12-14 12:41:00 +0100 |
---|---|---|
committer | Stefan Kögl <stefan@skoegl.net> | 2012-12-14 12:41:00 +0100 |
commit | 973e011de48eaa5cc2bba8840fac62f58180e6b5 (patch) | |
tree | 356af56d9c1a5e59dda5d8c59aa3e780f886922d | |
parent | d2c553591bbbaf72d74e93f75d49fb1bd839c0c0 (diff) | |
download | python-json-patch-973e011de48eaa5cc2bba8840fac62f58180e6b5.tar.gz |
fix exception handling for Python 2.5
-rw-r--r-- | jsonpatch.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/jsonpatch.py b/jsonpatch.py index 0eb3e55..a521bd0 100644 --- a/jsonpatch.py +++ b/jsonpatch.py @@ -352,8 +352,13 @@ class RemoveOperation(PatchOperation): subobj, part = self.pointer.to_last(obj) try: del subobj[part] - except KeyError as ex: - raise JsonPatchConflict(ex) + except KeyError: + exc_info = sys.exc_info() + exc = JsonPatchConflict(str(exc_info[1])) + if sys.version_info >= (3, 0): + raise exc.with_traceback(exc_info[2]) + else: + raise exc class AddOperation(PatchOperation): |