# docstring-extraneous-exception (DOC502)

Derived from the **pydoclint** linter.

This rule is unstable and in preview. The `--preview`

flag is required for use.

## What it does

Checks for function docstrings that include exceptions which are not explicitly raised.

## Why is this bad?

Some conventions prefer non-explicit exceptions be omitted from the docstring.

This rule is not enforced for stub functions.

## Example

```
def calculate_speed(distance: float, time: float) -> float:
"""Calculate speed as distance divided by time.
Args:
distance: Distance traveled.
time: Time spent traveling.
Returns:
Speed as distance divided by time.
Raises:
ZeroDivisionError: Divided by zero.
"""
return distance / time
```

Use instead: