---
source: crates/ruff_linter/src/rules/pydoclint/mod.rs
---
DOC502 Raised exception is not explicitly raised: `FasterThanLightError`
  --> DOC502_numpy.py:7:5
   |
 5 |   # DOC502
 6 |   def calculate_speed(distance: float, time: float) -> float:
 7 | /     """
 8 | |     Calculate speed as distance divided by time.
 9 | |
10 | |     Parameters
11 | |     ----------
12 | |     distance : float
13 | |         Distance traveled.
14 | |     time : float
15 | |         Time spent traveling.
16 | |
17 | |     Returns
18 | |     -------
19 | |     float
20 | |         Speed as distance divided by time.
21 | |
22 | |     Raises
23 | |     ------
24 | |     FasterThanLightError
25 | |         If speed is greater than the speed of light.
26 | |     """
   | |_______^
27 |       return distance / time
   |
help: Remove `FasterThanLightError` from the docstring

DOC502 Raised exceptions are not explicitly raised: `FasterThanLightError`, `DivisionByZero`
  --> DOC502_numpy.py:32:5
   |
30 |   # DOC502
31 |   def calculate_speed(distance: float, time: float) -> float:
32 | /     """
33 | |     Calculate speed as distance divided by time.
34 | |
35 | |     Parameters
36 | |     ----------
37 | |     distance : float
38 | |         Distance traveled.
39 | |     time : float
40 | |         Time spent traveling.
41 | |
42 | |     Returns
43 | |     -------
44 | |     float
45 | |         Speed as distance divided by time.
46 | |
47 | |     Raises
48 | |     ------
49 | |     FasterThanLightError
50 | |         If speed is greater than the speed of light.
51 | |     DivisionByZero
52 | |         If attempting to divide by zero.
53 | |     """
   | |_______^
54 |       return distance / time
   |
help: Remove `FasterThanLightError`, `DivisionByZero` from the docstring

DOC502 Raised exception is not explicitly raised: `DivisionByZero`
  --> DOC502_numpy.py:59:5
   |
57 |   # DOC502
58 |   def calculate_speed(distance: float, time: float) -> float:
59 | /     """
60 | |     Calculate speed as distance divided by time.
61 | |
62 | |     Parameters
63 | |     ----------
64 | |     distance : float
65 | |         Distance traveled.
66 | |     time : float
67 | |         Time spent traveling.
68 | |
69 | |     Returns
70 | |     -------
71 | |     float
72 | |         Speed as distance divided by time.
73 | |
74 | |     Raises
75 | |     ------
76 | |     FasterThanLightError
77 | |         If speed is greater than the speed of light.
78 | |     DivisionByZero
79 | |         If attempting to divide by zero.
80 | |     """
   | |_______^
81 |       try:
82 |           return distance / time
   |
help: Remove `DivisionByZero` from the docstring

DOC502 Raised exception is not explicitly raised: `ZeroDivisionError`
   --> DOC502_numpy.py:139:5
    |
137 |   # of the exceptions
138 |   def foo():
139 | /     """First line.
140 | |
141 | |     Raises
142 | |     ------
143 | |     ValueError
144 | |         some text
145 | |         .. math:: e^{xception}
146 | |     ZeroDivisionError
147 | |         Will not be raised, DOC502
148 | |     """
    | |_______^
149 |       raise ValueError
    |
help: Remove `ZeroDivisionError` from the docstring
