INNER CODE UNIT · Python

exception_tuple

falconry/falcon · falcon/app.py:1026

            exception_tuple = tuple(exception)  # type: ignore[arg-type]
        except TypeError:
            exception_tuple = (exception,)  # type: ignore[assignment]

        for exc in exception_tuple:
            if not issubclass(exc, Exception):
                raise TypeError('"exception" must be an exception type.')

            self._error_handlers[exc] = handler

    def set_error_serializer(self, serializer: ErrorSerializer[_ReqT, _RespT]) -> None:
        """Override the default serializer for instances of :class:`~.HTTPError`.

        When a responder raises an instance of :class:`~.HTTPError`,
        Falcon converts it to an HTTP response automatically. The
        default serializer supports JSON and XML, but may be overridden
        by this method to use a custom serializer in order to support
        other media types.

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…