Class BpmErrorBuilder<T extends BpmErrorBuilder<T>>
- Type Parameters:
T-
- Direct Known Subclasses:
BpmPublicErrorBuilder
BpmError builders- See Also:
- API:
- This is a public API.
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds a newerror.voidBuilds a newerrorand throws it.withAttribute(Object value) Add the givenvalueas attributewithAttribute(String name, Object value) Add the givenvalueas attribute with the givennamewithAttributes(Map<String, Object> attributes) Add all given attributes to this builderSets the givencausewithErrorCode(String errorCode) Sets the givenerrorCodewithMessage(String message) Sets the givenmessage
-
Method Details
-
withCause
Sets the given
causeExample:
try { execute(sql); } catch(SQLException ex) { BpmError.create("fincance:sql).withCause(ex).withAttribute("sql", sql).throwError(); }- Parameters:
cause-- Returns:
- builder
- See Also:
- API:
- This public API is available in Java.
-
withErrorCode
Sets the given
errorCodeExample:
BpmError errorCause = in.error; BpmError.create(errorCause).withErrorCode("finance:nomoney").build();- Parameters:
errorCode-- Returns:
- builder
- See Also:
- API:
- This public API is available in Java.
-
withMessage
Sets the given
messageExample:
BpmError.create("finance:nomoney").withMessage("There is no money left").build();- Parameters:
message-- Returns:
- builder
- See Also:
- API:
- This public API is available in Java.
-
withAttribute
Add the given
valueas attribute with the givennameExample:
BpmError.create("finance:nomoney").withAttribute("Currency", "CHF").build();- Parameters:
name- the name of the attributevalue- the value to set- Returns:
- builder
- See Also:
- API:
- This public API is available in Java.
-
withAttribute
Add the given
valueas attributeExample:
BpmError.create("finance:nomoney").withAttribute("CHF").build();- Parameters:
value-- Returns:
- builder
- See Also:
- API:
- This public API is available in Java.
-
withAttributes
Add all given attributes to this builder
Example:
Map attributes = new HashMap(); attributes.put("Currency", "CHF"); BpmError.create("finance:nomoney").withAttributes(attributes).build();- Parameters:
attributes-- Returns:
- builder
- See Also:
- API:
- This public API is available in Java.
-
throwError
public void throwError()Builds a new
errorand throws it. Uses all the information given to the builder before.Example:
BpmError.create("finance:nomoney").throwError();- API:
- This public API is available in Java.
-
build
Builds a new
error. Uses all the information given to the builder before.Example:
BpmError error = BpmError.create("finance:nomoney").build();- Returns:
- new build error
- API:
- This public API is available in Java.
-