Class GoogleJsonError (1.33.4)

public class GoogleJsonError extends GenericJson

Data class representing the Google JSON error response content, as documented for example in Error responses.

Inheritance

Object > java.util.AbstractMap > com.google.api.client.util.GenericData > com.google.api.client.json.GenericJson > GoogleJsonError

Static Methods

parse(JsonFactory jsonFactory, HttpResponse response)

public static GoogleJsonError parse(JsonFactory jsonFactory, HttpResponse response)

Parses the given error HTTP response using the given JSON factory.

Parameters
NameDescription
jsonFactorycom.google.api.client.json.JsonFactory

JSON factory

responsecom.google.api.client.http.HttpResponse

HTTP response

Returns
TypeDescription
GoogleJsonError

new instance of the Google JSON error information

Exceptions
TypeDescription
IOException

if content type is not Json#MEDIA_TYPE or if expected "data" or "error" key is not found

Constructors

GoogleJsonError()

public GoogleJsonError()

Methods

clone()

public GoogleJsonError clone()
Returns
TypeDescription
GoogleJsonError
Overrides
com.google.api.client.json.GenericJson.clone()

getCode()

public final int getCode()

Returns the HTTP status code of this response or null for none.

Returns
TypeDescription
int

getDetails()

public List<GoogleJsonError.Details> getDetails()
Returns
TypeDescription
List<Details>

getErrors()

public final List<GoogleJsonError.ErrorInfo> getErrors()

Returns the list of detailed errors or null for none.

Returns
TypeDescription
List<ErrorInfo>

getMessage()

public final String getMessage()

Returns the human-readable explanation of the error or null for none.

Returns
TypeDescription
String

set(String fieldName, Object value)

public GoogleJsonError set(String fieldName, Object value)
Parameters
NameDescription
fieldNameString
valueObject
Returns
TypeDescription
GoogleJsonError
Overrides
com.google.api.client.json.GenericJson.set(java.lang.String,java.lang.Object)

setCode(int code)

public final void setCode(int code)

Sets the HTTP status code of this response or null for none.

Parameter
NameDescription
codeint

setDetails(List<GoogleJsonError.Details> details)

public void setDetails(List<GoogleJsonError.Details> details)

Sets the list of invalid parameter error details as immutable to prevent exposing mutable state.

Parameter
NameDescription
detailsList<Details>

setErrors(List<GoogleJsonError.ErrorInfo> errors)

public final void setErrors(List<GoogleJsonError.ErrorInfo> errors)

Sets the list of detailed errors or null for none. Sets the list of detailed errors as immutable to prevent exposing mutable state.

Parameter
NameDescription
errorsList<ErrorInfo>

setMessage(String message)

public final void setMessage(String message)

Sets the human-readable explanation of the error or null for none.

Parameter
NameDescription
messageString