diff --git a/docs/release-notes/whats-new-3.rst b/docs/release-notes/whats-new-3.rst index e910c8eb63..5a0d05eceb 100644 --- a/docs/release-notes/whats-new-3.rst +++ b/docs/release-notes/whats-new-3.rst @@ -142,3 +142,11 @@ If you were relying on this utility, you can define it yourself as follows: def is_sync_or_async_generator(obj: Any) -> bool: return isgeneratorfunction(obj) or isasyncgenfunction(obj) + + +Removal of deprecated ``litestar.middleware.exceptions`` module and ``ExceptionHandlerMiddleware`` +-------------------------------------------------------------------------------------------------- + +The deprecated ``litestar.middleware.exceptions`` module and the +``ExceptionHandlerMiddleware`` have been removed. Since ``ExceptionHandlerMiddleware`` +has been applied automatically behind the scenes if necessary, no action is required. \ No newline at end of file diff --git a/litestar/middleware/exceptions/__init__.py b/litestar/middleware/exceptions/__init__.py deleted file mode 100644 index 6bbe58e7ad..0000000000 --- a/litestar/middleware/exceptions/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -from __future__ import annotations - -from typing import Any - -from litestar.middleware._internal.exceptions import middleware -from litestar.utils.deprecation import warn_deprecation - - -def __getattr__(name: str) -> Any: - if name == "ExceptionHandlerMiddleware": - warn_deprecation( - version="2.9", - deprecated_name=name, - kind="class", - removal_in="3.0", - info="ExceptionHandlerMiddleware has been removed from the public API.", - ) - return middleware.ExceptionHandlerMiddleware - raise AttributeError(f"module {__name__} has no attribute {name}") diff --git a/litestar/middleware/exceptions/_debug_response.py b/litestar/middleware/exceptions/_debug_response.py deleted file mode 100644 index fa075dccfe..0000000000 --- a/litestar/middleware/exceptions/_debug_response.py +++ /dev/null @@ -1,20 +0,0 @@ -from __future__ import annotations - -from typing import Any - -from litestar.exceptions import responses -from litestar.utils.deprecation import warn_deprecation - - -def __getattr__(name: str) -> Any: - if name == "create_debug_response": - warn_deprecation( - version="2.9", - deprecated_name=name, - kind="function", - removal_in="3.0", - alternative="litestar.exceptions.responses.create_debug_response", - ) - return responses.create_debug_response - - raise AttributeError(f"module {__name__} has no attribute {name}") diff --git a/litestar/middleware/exceptions/middleware.py b/litestar/middleware/exceptions/middleware.py deleted file mode 100644 index 3d653ebac1..0000000000 --- a/litestar/middleware/exceptions/middleware.py +++ /dev/null @@ -1,41 +0,0 @@ -from __future__ import annotations - -from typing import Any - -from litestar.exceptions import responses -from litestar.middleware._internal.exceptions import middleware -from litestar.utils.deprecation import warn_deprecation - - -def __getattr__(name: str) -> Any: - if name == "ExceptionHandlerMiddleware": - warn_deprecation( - version="2.9", - deprecated_name=name, - kind="class", - removal_in="3.0", - info="ExceptionHandlerMiddleware has been removed from the public API.", - ) - return middleware.ExceptionHandlerMiddleware - - if name == "create_exception_response": - warn_deprecation( - version="2.9", - deprecated_name=name, - kind="function", - removal_in="3.0", - alternative="litestar.exceptions.responses.create_exception_response", - ) - return responses.create_exception_response - - if name == "ExceptionResponseContent": - warn_deprecation( - version="2.9", - deprecated_name=name, - kind="class", - removal_in="3.0", - alternative="litestar.exceptions.responses.ExceptionResponseContent", - ) - return responses.ExceptionResponseContent - - raise AttributeError(f"module {__name__} has no attribute {name}")