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 |
---|---|
static DataServiceException |
createEntityNotImplemented()
|
static DataServiceException |
createEntityNotImplemented(EntityValue entity)
Return a new exception with status 501 (Not Implemented) for the "createEntity" method.
|
static DataServiceException |
deleteEntityNotImplemented()
|
static DataServiceException |
deleteEntityNotImplemented(EntityValue entity)
Return a new exception with status 501 (Not Implemented) for the "deleteEntity" method.
|
static DataServiceException |
executeQueryNotImplemented()
|
static DataServiceException |
executeQueryNotImplemented(DataQuery query)
Return a new exception with status 501 (Not Implemented) for the "executeQuery" method.
|
ErrorResponse |
getResponse()
Return (nullable) If the data service request returned on OData error response, then this holds the parsed error response.
|
int |
getStatus()
Return if the data service request failed with an HTTP error code, then
status holds the error code. |
java.lang.String |
getStatusText()
Return text describing
status code. |
static DataServiceException |
methodNotAllowed()
Return a new exception with status 405 (Method Not Allowed).
|
static DataServiceException |
notImplemented(java.lang.String method)
Return a new exception with status 501 (Not Implemented).
|
void |
setResponse(ErrorResponse value)
Set if the data service request returned on OData error response, then this holds the parsed error response.
|
void |
setStatus(int value)
Set if the data service request failed with an HTTP error code, then
status holds the error code. |
static DataServiceException |
updateEntityNotImplemented()
|
static DataServiceException |
updateEntityNotImplemented(EntityValue entity)
Return a new exception with status 501 (Not Implemented) for the "updateEntity" method.
|
static DataServiceException |
validationError(java.lang.String message)
Return a new exception with status 400 (Client Error) for a data validation error.
|
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.
|
getSafeMessage, safe, setSafeMessage
getCause, getMessage, setCause, setMessage, toString
protected DataServiceException(java.lang.String message, java.lang.Throwable cause)
public DataServiceException()
Default constructor.
public static DataServiceException createEntityNotImplemented()
public static DataServiceException createEntityNotImplemented(EntityValue entity)
Return a new exception with status 501 (Not Implemented) for the "createEntity" method.
entity
- (nullable) Optional entity value (unused, but may help to avoid compiler warnings in caller).public static DataServiceException deleteEntityNotImplemented()
public static DataServiceException deleteEntityNotImplemented(EntityValue entity)
Return a new exception with status 501 (Not Implemented) for the "deleteEntity" method.
entity
- (nullable) Optional entity value (unused, but may help to avoid compiler warnings in caller).public static DataServiceException executeQueryNotImplemented()
public static DataServiceException executeQueryNotImplemented(DataQuery query)
Return a new exception with status 501 (Not Implemented) for the "executeQuery" method.
query
- (nullable) Optional data query (unused, but may help to avoid compiler warnings in caller).public ErrorResponse getResponse()
Return (nullable) If the data service request returned on OData error response, then this holds the parsed error response. Otherwise null
.
null
.public int getStatus()
Return if the data service request failed with an HTTP error code, then status
holds the error code. Otherwise zero.
status
holds the error code. Otherwise zero.public java.lang.String getStatusText()
Return text describing status
code.
public static DataServiceException methodNotAllowed()
Return a new exception with status 405 (Method Not Allowed).
public static DataServiceException notImplemented(java.lang.String method)
Return a new exception with status 501 (Not Implemented).
method
- Name of method that is not implemented.public void setResponse(ErrorResponse value)
Set if the data service request returned on OData error response, then this holds the parsed error response. Otherwise null
.
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)
Set if the data service request failed with an HTTP error code, then status
holds the error code. Otherwise zero.
value
- If the data service request failed with an HTTP error code, then status
holds the error code. Otherwise zero.public static DataServiceException updateEntityNotImplemented()
public static DataServiceException updateEntityNotImplemented(EntityValue entity)
Return a new exception with status 501 (Not Implemented) for the "updateEntity" method.
entity
- (nullable) Optional entity value (unused, but may help to avoid compiler warnings in caller).public static DataServiceException validationError(java.lang.String message)
Return a new exception with status 400 (Client Error) for a data validation error.
message
- Validation error message to be received by the client.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)
status
- Status parameter.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.