@webob.dec.wsgify(RequestClass=wsgi.Request)
    def __call__(self, req):
        # Replace the body with fault details.
        code = self.wrapped_exc.status_int
        fault_name = self._fault_names.get(code, "cloudServersFault")
        fault_data = {
            fault_name: {
                'code': code,
                'message': self.wrapped_exc.explanation}}
        if code == 413:
            retry = self.wrapped_exc.headers['Retry-After']
            fault_data[fault_name]['retryAfter'] = retry

        # 'code' is an attribute on the fault tag itself
        metadata = {'attributes': {fault_name: 'code'}}

        content_type = req.best_match_content_type()

        xml_serializer = {
            '1.0': wsgi.XMLDictSerializer(metadata, wsgi.XMLNS_V10),
            '1.1': wsgi.XMLDictSerializer(metadata, wsgi.XMLNS_V11),
        }[common.get_version_from_href(req.url)]

        serializer = {
            'application/xml': xml_serializer,
            'application/json': wsgi.JSONDictSerializer(),
        }[content_type]

        self.wrapped_exc.body = serializer.serialize(fault_data)
        self.wrapped_exc.content_type = content_type

        return self.wrapped_exc
Generate a WSGI response based on the exception passed to ctor.
dataset/ETHPy150Open nii-cloud/dodai-compute/nova/api/openstack/faults.py/Fault.__call__