Skip to content

Commit 7e02118

Browse files
committed
Tell valid strategies on error
1 parent 58425df commit 7e02118

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/mkdocstrings_handlers/python/rendering.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,10 @@ def do_optionally_inherit_docstrings(
432432
Parameters:
433433
objects: The objects to inherit docstrings from.
434434
"""
435-
strategy = DocstringInheritStrategy(docstring_inherit_strategy)
435+
try:
436+
strategy = DocstringInheritStrategy(docstring_inherit_strategy)
437+
except ValueError as e:
438+
raise ValueError(f"Unknown docstring inherit strategy: '{docstring_inherit_strategy}', allowed options are: {', '.join(strategy.value for strategy in DocstringInheritStrategy)}") from e
436439

437440
if strategy == DocstringInheritStrategy.default:
438441
return objects

0 commit comments

Comments
 (0)