Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion jsonpointer.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ def join(self, suffix):
suffix_parts = suffix
try:
return self.__class__.from_parts(chain(self.parts, suffix_parts))
except: # noqa E722
except Exception:
raise JsonPointerException("Invalid suffix")

def __truediv__(self, suffix):
Expand Down
13 changes: 13 additions & 0 deletions tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,19 @@ def test_join_magic(self):
ptr12e = self.ptr1 / ["a", "b"]
self.assertEqual(ptr12e.path, "/a/b/c/a/b")

def test_join_preserves_control_flow_exceptions(self):
for exception_type in (KeyboardInterrupt, SystemExit, GeneratorExit):
with self.subTest(exception_type=exception_type):
error = exception_type()

def parts():
yield 'valid'
raise error

with self.assertRaises(exception_type) as caught:
self.ptr1.join(parts())
self.assertIs(caught.exception, error)

def test_join_subclass(self):
class Pointer(JsonPointer):
pass
Expand Down
Loading