Skip to content

Commit

Permalink
fix: register encoder's doc incorrectly mentions TypeError (#384)
Browse files Browse the repository at this point in the history
Since #358, custom encoders are expected to raise a ConvertError instead
of a TypeError, but the docstring of register_encoder still mentions
TypeError. Fix this to mention ConvertError instead.
  • Loading branch information
mathieu-lemay authored Nov 12, 2024
1 parent e6e5d38 commit 2777bed
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tomlkit/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def comment(string: str) -> Comment:
def register_encoder(encoder: E) -> E:
"""Add a custom encoder, which should be a function that will be called
if the value can't otherwise be converted. It should takes a single value
and return a TOMLKit item or raise a ``TypeError``.
and return a TOMLKit item or raise a ``ConvertError``.
"""
CUSTOM_ENCODERS.append(encoder)
return encoder
Expand Down

0 comments on commit 2777bed

Please sign in to comment.