Class ErrorResponse.Builder
java.lang.Object
com.helixframework.api.contract.error.ErrorResponse.Builder
- Enclosing class:
- ErrorResponse
Builds instances of
ErrorResponse.-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds a new instance ofErrorResponse.withAttribute(String key, Object value) Adds the supplied attribute to the error.withAttributes(Map<String, Object> attributes) Adds the supplied attributes to the error.Sets the application error code.withDebug(ErrorResponse.Debug debug) Adds debug information to the error.Sets the error identifier.withMessage(String message) Sets the error message.withStatus(int status) Sets the HTTP status.withSubError(String message) Adds a sub-level error message to the error.withSubError(String name, String message) Adds a sub-level error message to the error.withSubError(String object, String name, Object rejectedValue, String message) Adds a sub-level error message to the error.withSubError(String code, String name, String message) Adds a sub-level error message to the error.Adds a sub-level error message to the error.withSubErrors(List<ErrorResponse.SubError> subErrors) Adds a collection of sub-level error messages to the error.withTimestamp(String timestamp) Sets the timestamp of when the error occurred.
-
Method Details
-
withId
Sets the error identifier.- Parameters:
id- error identifier- Returns:
- builder
-
withCode
Sets the application error code.- Parameters:
code- application error code- Returns:
- builder
-
withStatus
Sets the HTTP status.- Parameters:
status- HTTP status- Returns:
- builder
-
withTimestamp
Sets the timestamp of when the error occurred.- Parameters:
timestamp- timestamp- Returns:
- builder
-
withMessage
Sets the error message.- Parameters:
message- error message- Returns:
- builder
-
withAttribute
Adds the supplied attribute to the error.- Parameters:
key- attribute keyvalue- attribute value- Returns:
- builder
-
withAttributes
Adds the supplied attributes to the error.- Parameters:
attributes- attributes- Returns:
- builder
-
withSubError
Adds a sub-level error message to the error.- Parameters:
message- field error message- Returns:
- builder
-
withSubError
Adds a sub-level error message to the error.- Parameters:
name- field namemessage- field error message- Returns:
- builder
-
withSubError
Adds a sub-level error message to the error.- Parameters:
code- field error codename- field namemessage- field error message- Returns:
- builder
-
withSubError
public ErrorResponse.Builder withSubError(String object, String name, Object rejectedValue, String message) Adds a sub-level error message to the error.- Parameters:
object- object with errorname- field namerejectedValue- rejected field valuemessage- field error message- Returns:
- builder
-
withSubError
public ErrorResponse.Builder withSubError(String code, String object, String name, Object rejectedValue, String message) Adds a sub-level error message to the error.- Parameters:
code- field error codeobject- object with errorname- field namerejectedValue- rejected field valuemessage- field error message- Returns:
- builder
-
withSubErrors
Adds a collection of sub-level error messages to the error.- Parameters:
subErrors- sub-level error messages- Returns:
- builder
-
withDebug
Adds debug information to the error.- Parameters:
debug- debug info- Returns:
- builder
-
build
Builds a new instance ofErrorResponse.- Returns:
- error response
-