summaryrefslogtreecommitdiffstatshomepage
path: root/tests/basics/exception_chain.py
blob: 14dd6dfbade8ecb16e22fa8de9667958d024ac88 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# Exception chaining is not supported, but check that basic
# exception works as expected.

try:
    raise Exception from None
except Exception:
    print("Caught Exception")

try:
    try:
        raise ValueError("Value")
    except Exception as exc:
        raise RuntimeError("Runtime") from exc
except Exception as ex2:
    print("Caught Exception:", ex2)