From 00b902852a4450d3707b33a9dba13a4188a5483a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Thu, 30 Oct 2025 05:38:15 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20new=20error=20for=20invalid?= =?UTF-8?q?=20dependencies'=20scopes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fastapi/exceptions.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fastapi/exceptions.py b/fastapi/exceptions.py index bb775fcbf..ca889c7cb 100644 --- a/fastapi/exceptions.py +++ b/fastapi/exceptions.py @@ -147,6 +147,12 @@ class FastAPIError(RuntimeError): """ +class DependencyScopeError(FastAPIError): + """ + A dependency declared that it depends on another dependency with an invalid + (narrower) scope. + """ + class ValidationException(Exception): def __init__(self, errors: Sequence[Any]) -> None: self._errors = errors