summaryrefslogtreecommitdiff
path: root/doc/data/messages/l/lost-exception/good.py
blob: a269492621f16ed5e529196538be64ebd0c68e02 (plain)
1
2
3
4
5
6
7
8
9
10
class FasterThanTheSpeedOfLightError(ZeroDivisionError):
    def __init__(self):
        super().__init__("You can't go faster than the speed of light !")


def calculate_speed(distance: float, time: float) -> float:
    try:
        return distance / time
    except ZeroDivisionError as e:
        raise FasterThanTheSpeedOfLightError() from e