Package com.okta.sdk.resource
Class ResourceException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- com.okta.sdk.resource.ResourceException
-
- All Implemented Interfaces:
Error
,java.io.Serializable
- Direct Known Subclasses:
IncorrectCredentialsException
,InvalidAuthenticationException
,InvalidCredentialsException
,MissingCredentialsException
,UnsupportedAuthenticationSchemeException
public class ResourceException extends java.lang.RuntimeException implements Error
A Runtime exception typically thrown when the remote server returns a non 20x response.- Since:
- 0.5.0
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ResourceException(Error error)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<ErrorCause>
getCauses()
Returns the list of causes of this error.java.lang.String
getCode()
Get the Okta Error Code, click here for the list of Okta error codes.Error
getError()
Returns the underlying RESTError
returned from the Okta API server.java.util.Map<java.lang.String,java.util.List<java.lang.String>>
getHeaders()
Returns the HTTP headers associated with this error response.java.lang.String
getId()
Returns the error ID of this error.int
getStatus()
Returns this error's HTTP status code.-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.okta.sdk.error.Error
getMessage
-
-
-
-
Constructor Detail
-
ResourceException
public ResourceException(Error error)
-
-
Method Detail
-
getStatus
public int getStatus()
Description copied from interface:Error
Returns this error's HTTP status code.
-
getCode
public java.lang.String getCode()
Get the Okta Error Code, click here for the list of Okta error codes.
-
getId
public java.lang.String getId()
Description copied from interface:Error
Returns the error ID of this error. This maybe used when opening a support case and troubleshooting.
-
getCauses
public java.util.List<ErrorCause> getCauses()
Description copied from interface:Error
Returns the list of causes of this error. When validating a resource (for example a User) multiple validation errors could occur.
-
getHeaders
public java.util.Map<java.lang.String,java.util.List<java.lang.String>> getHeaders()
Description copied from interface:Error
Returns the HTTP headers associated with this error response.- Specified by:
getHeaders
in interfaceError
- Returns:
- A list headers, which could be {code}null{code} or empty
-
getError
public Error getError()
Returns the underlying RESTError
returned from the Okta API server.Because this class's
getMessage()
value returns a developer-friendly message to help you debug when you see stack traces, you might want to acquire the underlyingError
to show an end-user the simpler end-user appropriate error message. The end-user error message is non-technical in nature - as a convenience, you can show this message directly to your application end-users.For example:
try { //something that causes a ResourceException } catch (ResourceException re) { String endUserMessage = re.getError().getMessage(); warningDialog.setText(endUserMessage); }
- Returns:
- the underlying REST
Error
resource representation returned from the Okta API server.
-
-