public interface ErrorResponseBuilder
| Modifier and Type | Method and Description |
|---|---|
ErrorResponseBuilder |
addContainerMessages(Severity... severities)
Adds the non-leading container messages with the given severities to the
ErrorResponse.
|
ErrorResponseBuilder |
addErrorDetail(String messageKey,
String target,
Object... params)
Adds a new error detail.
|
ErrorResponse |
response()
Returns an instance of ErrorResponse object.
|
ErrorResponseBuilder |
setCause(Throwable throwable)
Sets the exception that caused the operation to fail in the
ErrorResponseBuilder object.
|
ErrorResponseBuilder |
setErrorCode(String errorCode)
Sets the error code in the ErrorResponseBuilder object.
|
ErrorResponseBuilder |
setMessage(String messageKey,
Object... params)
Sets the error message considering localization.
|
ErrorResponseBuilder |
setStatusCode(int statusCode)
Sets the status code of the error in the ErrorResponseBuilder object.
|
ErrorResponseBuilder setCause(Throwable throwable)
throwable - A Throwable object that represents the exceptionErrorResponseBuilder object containing the
exceptionErrorResponseBuilder setStatusCode(int statusCode)
statusCode - An int representing the status codeErrorResponseBuilder object containing the status
codeErrorResponseBuilder setMessage(String messageKey, Object... params)
messageKey - A String key associated with the message in
properties file to retrieve the message text.
In case there is no value for such a key in the property
file, the message key itself will be taken as the message text.
This parameter is set as the error code in the error response
only if the error code is not explicitly set using setErrorCode API.params - Variable length array of objects for this message. These
objects will be converted to strings and substituted in the messageText in place
of parameter placeholders. In case there are no parameters, do not
pass any objects for this argument.ErrorResponseBuilder object containing the
message.ErrorResponse response()
ErrorResponse objectErrorResponseBuilder addContainerMessages(Severity... severities)
severities - A variable length argument which denotes the severity of the
messages which have to be added from the MessageContainer to
the error response.ErrorResponseBuilder addErrorDetail(String messageKey, String target, Object... params)
messageKey - associated with the message, used as the key to a properties
file to retrieve the message text.target - Target for which this error detail applies.params - Variable length array of parameters for this message.ErrorResponseBuilder setErrorCode(String errorCode)
errorCode - A String representing the error codeErrorResponseBuilder object containing the error
codeCopyright © 2020 SAP. All Rights Reserved.