Class HttpResponseMessageExtensions (1.69.0)

public static class HttpResponseMessageExtensions

Extensions for HttpResponseMessage to help with parasing errors as returned by some Google services.

Inheritance

object > HttpResponseMessageExtensions

Namespace

Google.Apis.Responses

Assembly

Google.Apis.dll

Methods

DeserializeErrorAsync(HttpResponseMessage, string, ISerializer)

public static Task<RequestError> DeserializeErrorAsync(this HttpResponseMessage response, string name, ISerializer serializer)

Attempts to deserialize a RequestError from the response.

Parameters
Name Description
response HttpResponseMessage
name string
serializer ISerializer
Returns
Type Description
TaskRequestError
Remarks

This method will throw a GoogleApiException if:

  • The response or its Content are null.
  • Or the deserialization attempt throws a Newtonsoft.Json.JsonException.
  • Or the deserilization attempt returns null.
Any exception thrown while reading the responseContent will be bubbled up. Otherwise this method will return the deserialized RequestError.