Class ResourceException

All Implemented Interfaces:
Error, Serializable
Direct Known Subclasses:
RetryableException

public class ResourceException extends RuntimeException implements Error
A Runtime exception typically thrown when the remote server returns a non 20x response.
Since:
0.5.0
See Also:
  • Constructor Details

    • ResourceException

      public ResourceException(Error error)
  • Method Details

    • getStatus

      public int getStatus()
      Description copied from interface: Error
      Returns this error's HTTP status code.
      Specified by:
      getStatus in interface Error
      Returns:
      the status code of this Error
    • getCode

      public String getCode()
      Get the Okta Error Code, click here for the list of Okta error codes.
      Specified by:
      getCode in interface Error
      Returns:
      the code of the error
    • getId

      public String getId()
      Description copied from interface: Error
      Returns the error ID of this error. This maybe used when opening a support case and troubleshooting.
      Specified by:
      getId in interface Error
      Returns:
      error ID of this error
    • getCauses

      public 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.
      Specified by:
      getCauses in interface Error
      Returns:
      A list of causes, which could be {code}null{code} or empty
    • getHeaders

      public Map<String,List<String>> getHeaders()
      Description copied from interface: Error
      Returns the HTTP headers associated with this error response.
      Specified by:
      getHeaders in interface Error
      Returns:
      A list headers, which could be {code}null{code} or empty
    • getError

      public Error getError()
      Returns the underlying REST Error 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 underlying Error 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.