From e1a75a80fe7a01dbe1b92abff399cd13af4d0a43 Mon Sep 17 00:00:00 2001 From: Michael Oliver Date: Fri, 21 Jan 2022 10:59:56 +0000 Subject: [PATCH] Adjust type of `exception_handlers` to allow async callable --- starlette/applications.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/starlette/applications.py b/starlette/applications.py index 9f05dc286..ab6792527 100644 --- a/starlette/applications.py +++ b/starlette/applications.py @@ -44,7 +44,10 @@ def __init__( routes: typing.Sequence[BaseRoute] = None, middleware: typing.Sequence[Middleware] = None, exception_handlers: typing.Mapping[ - typing.Any, typing.Callable[[Request, Exception], Response] + typing.Any, + typing.Callable[ + [Request, Exception], typing.Union[Response, typing.Awaitable[Response]] + ], ] = None, on_startup: typing.Sequence[typing.Callable] = None, on_shutdown: typing.Sequence[typing.Callable] = None,