Class GoogleJsonError (2.5.0)

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
Name Description
jsonFactory com.google.api.client.json.JsonFactory

JSON factory

response com.google.api.client.http.HttpResponse

HTTP response

Returns
Type Description
GoogleJsonError

new instance of the Google JSON error information

Exceptions
Type Description
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
Type Description
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
Type Description
int

getDetails()

public List<GoogleJsonError.Details> getDetails()
Returns
Type Description
List<Details>

getErrors()

public final List<GoogleJsonError.ErrorInfo> getErrors()

Returns the list of detailed errors or null for none.

Returns
Type Description
List<ErrorInfo>

getMessage()

public final String getMessage()

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

Returns
Type Description
String

set(String fieldName, Object value)

public GoogleJsonError set(String fieldName, Object value)
Parameters
Name Description
fieldName String
value Object
Returns
Type Description
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
Name Description
code int

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
Name Description
details List<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
Name Description
errors List<ErrorInfo>

setMessage(String message)

public final void setMessage(String message)

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

Parameter
Name Description
message String