Class BpmErrorBuilder<T extends BpmErrorBuilder<T>>
- java.lang.Object
-
- ch.ivyteam.ivy.bpm.error.BpmErrorBuilder<T>
-
- Type Parameters:
T-
- Direct Known Subclasses:
BpmPublicErrorBuilder
public class BpmErrorBuilder<T extends BpmErrorBuilder<T>> extends Object
Base class of allBpmErrorbuilders- See Also:
BpmError.create(String),BpmError.create(BpmError)- API:
- This is a public API.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BpmErrorbuild()Builds a newerror.voidthrowError()Builds a newerrorand throws it.TwithAttribute(Object value)Add the givenvalueas attributeTwithAttribute(String name, Object value)Add the givenvalueas attribute with the givennameTwithAttributes(Map<String,Object> attributes)Add all given attributes to this builderTwithCause(Throwable cause)Sets the givencauseTwithErrorCode(String errorCode)Sets the givenerrorCodeTwithMessage(String message)Sets the givenmessage
-
-
-
Method Detail
-
withCause
public T withCause(Throwable cause)
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:
BpmError.getCause(),BpmError.getErrorCause(),BpmError.getTechnicalCause()- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
withErrorCode
public T withErrorCode(String errorCode)
Sets the given
errorCodeExample:
BpmError errorCause = in.error; BpmError.create(errorCause).withErrorCode("finance:nomoney").build();- Parameters:
errorCode-- Returns:
- builder
- See Also:
BpmError.getErrorCode()- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
withMessage
public T withMessage(String message)
Sets the given
messageExample:
BpmError.create("finance:nomoney").withMessage("There is no money left").build();- Parameters:
message-- Returns:
- builder
- See Also:
BpmError.getMessage(),BpmError.getErrorMessage()- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
withAttribute
public T withAttribute(String name, Object value)
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:
withAttribute(Object),withAttribute(String, Object),BpmError.getAttribute(String),BpmError.getAttributeNames(),BpmError.getMessage(),BpmError.getErrorMessage(),BpmError.getErrorMessage(String)- API:
- This public API is available in IvyScript and Java. It has the visibility ADVANCED.
-
withAttribute
public T withAttribute(Object value)
Add the given
valueas attributeExample:
BpmError.create("finance:nomoney").withAttribute("CHF").build();- Parameters:
value-- Returns:
- builder
- See Also:
withAttributes(Map),withAttribute(String, Object),BpmError.getAttribute(String),BpmError.getAttributeNames(),BpmError.getMessage(),BpmError.getErrorMessage(),BpmError.getErrorMessage(String)- API:
- This public API is available in IvyScript and Java. It has the visibility ADVANCED.
-
withAttributes
public T withAttributes(Map<String,Object> attributes)
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:
withAttribute(Object),withAttribute(String, Object),BpmError.getAttribute(String),BpmError.getAttributeNames(),BpmError.getMessage(),BpmError.getErrorMessage(),BpmError.getErrorMessage(String)- API:
- This public API is available in IvyScript and Java. It has the visibility ADVANCED.
-
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 IvyScript and Java. It has the visibility NOVICE.
-
-