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 allBpmError
builders- 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 BpmError
build()
Builds a newerror
.void
throwError()
Builds a newerror
and throws it.T
withAttribute(Object value)
Add the givenvalue
as attributeT
withAttribute(String name, Object value)
Add the givenvalue
as attribute with the givenname
T
withAttributes(Map<String,Object> attributes)
Add all given attributes to this builderT
withCause(Throwable cause)
Sets the givencause
T
withErrorCode(String errorCode)
Sets the givenerrorCode
T
withMessage(String message)
Sets the givenmessage
-
-
-
Method Detail
-
withCause
public T withCause(Throwable cause)
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:
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
errorCode
Example:
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
message
Example:
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
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:
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
value
as 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
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 IvyScript and Java. It has the visibility NOVICE.
-
-