def set_response(self):
        """Modify ``cherrypy.response`` to represent ``self``.

        Modifies status, headers, and body.

        CherryPy uses this internally, but you can also use it to create
        an HTTPError object and set its output without *raising* the
        exception.
        """
        response = cherrypy.serving.response

        clean_headers(self.code)

        # In all cases, finalize will be called after this method,
        # so don't bother cleaning up response values here.
        response.status = self.status
        tb = None
        if cherrypy.serving.request.show_tracebacks:
            tb = format_exc()

        response.headers.pop('Content-Length', None)

        content = self.get_error_page(
            self.status,
            traceback=tb,
            message=self._message,
        )
        response.body = content

        _be_ie_unfriendly(self.code)
Modify ``cherrypy.response`` to represent ``self``.

        Modifies status, headers, and body.

        CherryPy uses this internally, but you can also use it to create
        an HTTPError object and set its output without *raising* the
        exception.
        
cherrypy/_cperror.py