"""
This type stub file was generated by pyright.
"""

import typing as t
from starlette.middleware.errors import ServerErrorMiddleware as StarletteServerErrorMiddleware
from starlette.types import ASGIApp
from connexion.lifecycle import ConnexionRequest, ConnexionResponse
from connexion.middleware.exceptions import connexion_wrapper
from connexion.types import MaybeAwaitable

logger = ...
class ServerErrorMiddleware(StarletteServerErrorMiddleware):
    """Subclass of starlette ServerErrorMiddleware to change handling of Unhandled Server
    exceptions to existing connexion behavior."""
    def __init__(self, next_app: ASGIApp, handler: t.Optional[t.Callable[[ConnexionRequest, Exception], MaybeAwaitable[ConnexionResponse]]] = ...) -> None:
        ...
    
    @staticmethod
    @connexion_wrapper
    def error_response(_request: ConnexionRequest, exc: Exception) -> ConnexionResponse:
        """Default handler for any unhandled Exception"""
        ...
    


