Class ServiceApiException

    • Field Detail

      • DEFAULT_STATUS_CODE

        public final int DEFAULT_STATUS_CODE
        the default value of status code if there is no status code for this service failure.
        See Also:
        Constant Field Values
      • DEFAULT_ERROR_CODE

        public final String DEFAULT_ERROR_CODE
        the default value of error code if there is no error code for this service failure.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ServiceApiException

        public ServiceApiException​(String message)
        Constructs a ServiceApiException with the specified detail message.
        Parameters:
        message - exception detail message
      • ServiceApiException

        public ServiceApiException​(String message,
                                   String requestTrackingId,
                                   int statusCode)
        Constructs a ServiceApiException with the specified detail message, requestId and returned HTTP status code.
        Parameters:
        message - exception detail message
        requestTrackingId - X-Request-Id header value to track the request
        statusCode - HTTP Status code returned in API response
      • ServiceApiException

        public ServiceApiException​(String message,
                                   String requestTrackingId,
                                   int statusCode,
                                   String errorCode)
        Constructs a ServiceApiException with the specified detail message, requestId, returned HTTP status code and error code.
        Parameters:
        message - exception detail message
        requestTrackingId - X-Request-Id header value to track the request
        statusCode - HTTP Status code returned in API response
        errorCode - Error code returned in API response
    • Method Detail

      • getStatusCode

        public int getStatusCode()
        Returns the HTTP Status code or DEFAULT_STATUS_CODE if the status code doesn't adequately represent the error.
        Returns:
        the HTTP Status code or DEFAULT_STATUS_CODE if the status code doesn't adequately represent the error.
      • getErrorCode

        public String getErrorCode()
        Returns the Error code or DEFAULT_ERROR_CODE if the error code doesn't adequately represent the error.
        Returns:
        the Error code or DEFAULT_ERROR_CODE if the error code doesn't adequately represent the error.
      • getMessage

        public String getMessage()
        Returns the detail message of this exception.
        Overrides:
        getMessage in class Throwable
        Returns:
        the detail message
      • getRequestTrackingId

        public String getRequestTrackingId()
        Returns the Request ID (the value of the X-Request-ID header).
        Returns:
        Request ID