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