public class OAuthException extends Exception
Constructor and Description |
---|
OAuthException(OAuthError error,
String description,
String errorUri)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
org.json.JSONObject |
createErrorDocument()
Returns a JSON representation of the current object as a
JSONObject . |
OAuthError |
getError()
Returns the kind of OAuth error.
|
String |
getErrorDescription()
Returns the description of the error.
|
String |
getErrorUri()
Returns the URI of the resource that gives more details about the error.
|
String |
getErrorURI()
Deprecated.
use
getErrorUri() instead. |
void |
setError(OAuthError error)
Sets the kind of OAuth error.
|
void |
setErrorDescription(String errorDescription)
Sets the description of the error.
|
void |
setErrorUri(String errorUri)
Sets the URI of the resource that gives more details about the error.
|
static OAuthException |
toOAuthException(Form parameters)
Returns a new
OAuthException based on the given parameters. |
static OAuthException |
toOAuthException(org.json.JSONObject json)
Returns a new
OAuthException based on the JSON payload. |
static OAuthException |
toOAuthException(Throwable exception)
Returns a new
OAuthException based on the given exception. |
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
public OAuthException(OAuthError error, String description, String errorUri)
error
- The OAuth error.description
- The description of the exception.errorUri
- The URI of the resource that gives more details about the error.public static OAuthException toOAuthException(Form parameters)
OAuthException
based on the given parameters. It especially looks for the given parameters:OAuthResourceDefs.ERROR
for the kind of Exception (see OAuthError
for the supported values),OAuthResourceDefs.ERROR_DESC
for the description,OAuthResourceDefs.ERROR_URI
for the URI of a documentation resource. parameters
- The parameters used to set up the OAuthException
.OAuthException
.public static OAuthException toOAuthException(org.json.JSONObject json) throws org.json.JSONException
OAuthException
based on the JSON payload. It especially looks for the given parameters:OAuthResourceDefs.ERROR
for the kind of Exception (see OAuthError
for the supported values),OAuthResourceDefs.ERROR_DESC
for the description,OAuthResourceDefs.ERROR_URI
for the URI of a documentation resource. json
- The JSON object used to set up the OAuthException
.OAuthException
.org.json.JSONException
public static OAuthException toOAuthException(Throwable exception)
OAuthException
based on the given exception.exception
- The exception.OAuthException
.public org.json.JSONObject createErrorDocument() throws org.json.JSONException
JSONObject
.JSONObject
.org.json.JSONException
public OAuthError getError()
public String getErrorDescription()
public String getErrorUri()
@Deprecated public String getErrorURI()
getErrorUri()
instead.public void setError(OAuthError error)
error
- The kind of OAuth error.public void setErrorDescription(String errorDescription)
errorDescription
- The description of the error.public void setErrorUri(String errorUri)
errorUri
- The URI of the resource that gives more details about the error.Copyright © 2005-2017 Restlet.