public class DataServiceException extends DataException
Exception thrown when a DataService
request fails due to a data service issue.
Modifier | Constructor and Description |
---|---|
|
DataServiceException()
Default constructor.
|
protected |
DataServiceException(java.lang.String message,
java.lang.Throwable cause) |
Modifier and Type | Method and Description |
---|---|
ErrorResponse |
getResponse()
(nullable) If the data service request returned on OData error response, then this holds the parsed error response.
|
int |
getStatus()
If the data service request failed with an HTTP error code, then
status holds the error code. |
java.lang.String |
getStatusText()
Text describing
status code. |
void |
setResponse(ErrorResponse value)
If the data service request returned on OData error response, then this holds the parsed error response.
|
void |
setStatus(int value)
If the data service request failed with an HTTP error code, then
status holds the error code. |
static DataServiceException |
withCause(java.lang.RuntimeException cause)
Return a new exception with the specified root cause.
|
static DataServiceException |
withCauseAndMessage(java.lang.RuntimeException cause,
java.lang.String message)
Return a new exception with the specified root cause and message text.
|
static DataServiceException |
withMessage(java.lang.String message)
Return a new exception with the specified message text.
|
static DataServiceException |
withResponse(int status,
java.lang.String message,
ErrorResponse response)
Return a new exception with the specified error code, message text and error response.
|
static DataServiceException |
withStatus(int status)
|
static DataServiceException |
withStatus(int status,
java.lang.String message)
Return a new exception with the specified error code and message text.
|
getCause, getMessage, setCause, setMessage, toString
protected DataServiceException(java.lang.String message, java.lang.Throwable cause)
public DataServiceException()
Default constructor.
public ErrorResponse getResponse()
(nullable) If the data service request returned on OData error response, then this holds the parsed error response. Otherwise null
.
public int getStatus()
If the data service request failed with an HTTP error code, then status
holds the error code. Otherwise zero.
public java.lang.String getStatusText()
Text describing status
code.
public void setResponse(ErrorResponse value)
If the data service request returned on OData error response, then this holds the parsed error response. Otherwise null
.
public void setStatus(int value)
If the data service request failed with an HTTP error code, then status
holds the error code. Otherwise zero.
public static DataServiceException withCause(java.lang.RuntimeException cause)
Return a new exception with the specified root cause.
cause
- (nullable) Root cause.public static DataServiceException withCauseAndMessage(java.lang.RuntimeException cause, java.lang.String message)
Return a new exception with the specified root cause and message text.
cause
- (nullable) Root cause.message
- (nullable) Message text.public static DataServiceException withMessage(java.lang.String message)
Return a new exception with the specified message text.
message
- (nullable) Message text.public static DataServiceException withResponse(int status, java.lang.String message, ErrorResponse response)
Return a new exception with the specified error code, message text and error response.
status
- Error code.message
- (nullable) Message text.response
- (nullable) Error response.public static DataServiceException withStatus(int status)
public static DataServiceException withStatus(int status, java.lang.String message)
Return a new exception with the specified error code and message text.
status
- Error code.message
- (nullable) Message text.