INNER CODE UNIT · Python

wrap_old_handler

falconry/falcon · falcon/app.py:987

        def wrap_old_handler(
            old_handler: Callable[..., Any],
        ) -> ErrorHandler[_ReqT, _RespT]:
            @wraps(old_handler)
            def handler(
                req: _ReqT, resp: _RespT, ex: Exception, params: dict[str, Any]
            ) -> None:
                old_handler(ex, req, resp, params)

            return handler  # type: ignore[return-value]

        if handler is None:
            handler = getattr(exception, 'handle', None)
            if handler is None:
                raise AttributeError(
                    'handler must either be specified explicitly or defined as a '
                    'static method named "handle" that is a member of the given '
                    'exception class.'

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…