summaryrefslogtreecommitdiff
path: root/doc/data/messages/b/bad-exception-cause/bad.py
blob: ad4228af824051e2fbd8ff5c616e7bb83ab0bea2 (plain)
1
2
3
4
5
6
7
8
def divide(x, y):
    result = 0
    try:
        result = x / y
    except ZeroDivisionError:
        # +1: [bad-exception-cause]
        raise ValueError(f"Division by zero when dividing {x} by {y} !") from result
    return result