def from_model_and_response(cls, model, response):
"""
Create a ``KubernetesError`` for the given error response from a
Kubernetes server.
:param model: The Kubernetes data model to use to convert the server
response into a Python object.
:param twisted.web.iweb.IResponse response: The response to inspect
for the error details.
:return Deferred(KubernetesError): The error with details attached.
"""
d = readBody(response)
d.addCallback(
lambda body: cls(
response.code,
model.iobject_from_raw(loads(body)),
),
)
return d
评论列表
文章目录