Class TokenResponseException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.io.IOException
com.google.api.client.http.HttpResponseException
com.google.api.client.auth.oauth2.TokenResponseException
- All Implemented Interfaces:
Serializable
public class TokenResponseException
extends com.google.api.client.http.HttpResponseException
Exception thrown when receiving an error response from the token server as specified in Error Response
To get the structured details, use getDetails().
Sample usage can be found for AuthorizationCodeTokenRequest.
- Since:
- 1.7
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.google.api.client.http.HttpResponseException
com.google.api.client.http.HttpResponseException.Builder -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final TokenErrorResponseToken error response details ornullif unable to parse.private static final long -
Constructor Summary
ConstructorsConstructorDescriptionTokenResponseException(com.google.api.client.http.HttpResponseException.Builder builder, TokenErrorResponse details) -
Method Summary
Modifier and TypeMethodDescriptionstatic TokenResponseExceptionfrom(com.google.api.client.json.JsonFactory jsonFactory, com.google.api.client.http.HttpResponse response) Returns a new instance ofTokenResponseException.final TokenErrorResponseReturns the token error response details ornullif unable to parse.Methods inherited from class com.google.api.client.http.HttpResponseException
computeMessageBuffer, getContent, getHeaders, getStatusCode, getStatusMessage, isSuccessStatusCodeMethods inherited from class Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
details
Token error response details ornullif unable to parse.
-
-
Constructor Details
-
TokenResponseException
TokenResponseException(com.google.api.client.http.HttpResponseException.Builder builder, TokenErrorResponse details) - Parameters:
builder- builderdetails- token error response details ornullif unable to parse
-
-
Method Details
-
getDetails
Returns the token error response details ornullif unable to parse. -
from
public static TokenResponseException from(com.google.api.client.json.JsonFactory jsonFactory, com.google.api.client.http.HttpResponse response) Returns a new instance ofTokenResponseException.If there is a JSON error response, it is parsed using
TokenErrorResponse, which can be inspected usinggetDetails(). Otherwise, the full response content is read and included in the exception message.- Parameters:
jsonFactory- JSON factoryresponse- HTTP response- Returns:
- new instance of
TokenErrorResponse
-