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
.void
Builds a newerror
and throws it.withAttribute
(Object value) Add the givenvalue
as attributewithAttribute
(String name, Object value) Add the givenvalue
as attribute with the givenname
withAttributes
(Map<String, Object> attributes) Add all given attributes to this builderSets the givencause
withErrorCode
(String errorCode) Sets the givenerrorCode
withMessage
(String message) Sets the givenmessage
-
Method Details
-
withCause
Sets the given
cause
Example:
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
errorCode
Example:
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
message
Example:
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
value
as attribute with the givenname
Example:
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
value
as 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
error
and 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.
-