Browse Source

Tweak wording of dependency with yield exception message

Co-authored-by: Motov Yurii <[email protected]>
pull/13264/head
Jeremy Epstein 7 months ago
committed by GitHub
parent
commit
e29fb2c08d
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 5
      fastapi/dependencies/utils.py

5
fastapi/dependencies/utils.py

@ -559,9 +559,8 @@ async def _solve_generator(
dependency_name = getattr(call, "__name__", "(unknown)") dependency_name = getattr(call, "__name__", "(unknown)")
raise FastAPIError( raise FastAPIError(
f"Dependency {dependency_name} raised: {ex}. There's a high chance that " f"Dependency {dependency_name} raised: {ex}. There's a high chance that "
"this is a dependency with yield that has a block with a bare except, or a " "this is a dependency with yield that catches an exception using except, "
"block with except Exception, and is not raising the exception again. Read " "but doesn't raise the exception again. Read more about it in the docs: "
"more about it in the docs: "
"https://fastapi.tiangolo.com/tutorial/dependencies/dependencies-with-yield" "https://fastapi.tiangolo.com/tutorial/dependencies/dependencies-with-yield"
"/#dependencies-with-yield-and-except" "/#dependencies-with-yield-and-except"
) from ex ) from ex

Loading…
Cancel
Save