Debian Codegraph @

test/units/mock/error_helper.py

raw
1 from __future__ import annotations
2
3 import collections.abc as c
4
5
6 def raise_exceptions(exceptions: c.Sequence[BaseException]) -> None:
7 """
8 Raise a chain of exceptions from the given exception list.
9 Exceptions will be raised starting from the end of the list.
10 """
11 if len(exceptions) > 1:
12 try:
13 raise_exceptions(exceptions[1:])
14 except Exception as ex:
15 raise exceptions[0] from ex
16
17 raise exceptions[0]