1 22
import _common
2

3 22
import sys
4

5

6 22
def custom_excepthook(*args):
7 20
    print("custom running!")
8 20
    return sys.__excepthook__(*args)
9

10

11 22
sys.excepthook = custom_excepthook
12

13
# Should warn that we'll get kinda-broken tracebacks
14 22
import trio
15

16
# The custom excepthook should run, because Trio was polite and didn't
17
# override it
18 22
raise trio.MultiError([ValueError(), KeyError()])

Read our documentation on viewing source code .

Loading