Class BpmError
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- ch.ivyteam.util.IvyRuntimeException
-
- ch.ivyteam.ivy.bpm.error.BpmError
-
- All Implemented Interfaces:
ch.ivyteam.util.IIvyException,Serializable
public class BpmError extends ch.ivyteam.util.IvyRuntimeExceptionProvides information about an error that occured in the process.
Use
create(String)to create or throw a newBpmError.- See Also:
- Serialized Form
- API:
- This is a public API.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classBpmError.AttributeNamesDefines names of attributes that are available on errors with certain error codes
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static BpmPublicErrorBuildercreate(BpmError errorCause)To create a newerrorwith the givenerrorCausestatic BpmPublicErrorBuildercreate(String errorCode)To create a newerrorwith the givenerrorCodeObjectgetAttribute(String name)Error attributes can be used to provide more information about the error.
The attributes can be use to format thedefault error messageanderror messages.Set<String>getAttributeNames()Error attributes can be used to provide more information about the error.
The attributes can be use to format thedefault error messageanderror messages.ThrowablegetCause()Returns the cause of this error.BpmErrorgetErrorCause()Returns the error cause of the error.StringgetErrorCode()The error code is used to identify different kind of business errors.StringgetErrorMessage()Returns the error message of this error.StringgetErrorMessage(String messageName)Returns the specific message with the givenmessageNameof this error.StringgetId()A unique error id.StringgetMessage()Returns the message of this error.List<BpmStackFrame>getProcessCallStack()The process call stack at the moment the error was thrown.
The process call stack is empty if the error was thrown in a top level process.BpmProcessElementgetProcessElement()The process element that threw (caused) the error.ThrowablegetTechnicalCause()Returns the technical cause of the error.voidsetAttribute(String name, Object value)Error attributes can be used to add more information about the error.
The attributes can be use to format thedefault error messageanderror messages.
-
-
-
Method Detail
-
create
public static BpmPublicErrorBuilder create(String errorCode)
To create a newerrorwith the givenerrorCodeExamples:
BpmError.create("finance:nomoney").build()
BpmError.create("finance:nomoney").withMessage("There is no money left").build()- Parameters:
errorCode-- Returns:
- error builder
- See Also:
create(BpmError),getErrorCode()- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
create
public static BpmPublicErrorBuilder create(BpmError errorCause)
To create a newerrorwith the givenerrorCauseExamples:
BpmError errorCause = in.error; BpmError.create(errorCause).build();
BpmError errorCause = in.error; BpmError.create(errorCause).withErrorCode("finance:nomoney").withMessage("There is no money left").build();- Parameters:
errorCause-- Returns:
- error builder
- See Also:
create(String),getErrorCause(),BpmErrorBuilder.withErrorCode(String)- API:
- This public API is available in IvyScript and Java. It has the visibility ADVANCED.
-
getId
public String getId()
A unique error id. Can be used to find more information about the error in the logs.- Returns:
- error id
- API:
- This public API is available in IvyScript and Java. It has the visibility ADVANCED.
-
getErrorCode
public String getErrorCode()
The error code is used to identify different kind of business errors. Error handlers use the error code to specify for which errors they are responsible for.- Returns:
- error code
- See Also:
BpmErrorBuilder.withErrorCode(String)- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
getTechnicalCause
public Throwable getTechnicalCause()
Returns the technical cause of the error.- Returns:
- Java exception that triggered the error handling. Maybe null.
- See Also:
getErrorCause(),getCause(),BpmErrorBuilder.withCause(Throwable)- API:
- This public API is available in IvyScript and Java. It has the visibility EXPERT.
-
getErrorCause
public BpmError getErrorCause()
Returns the error cause of the error.- Returns:
- the error that was the cause of this error. Maybe null.
- See Also:
getTechnicalCause(),getCause(),BpmErrorBuilder.withCause(Throwable)- API:
- This public API is available in IvyScript and Java. It has the visibility ADVANCED.
-
getCause
public Throwable getCause()
Returns the cause of this error.
This is either the
getErrorCause()or thegetTechnicalCause()or null.- See Also:
Throwable.getCause(),getErrorCause(),getTechnicalCause()- API:
- This public API is available in IvyScript and Java. It has the visibility EXPERT.
-
setAttribute
public void setAttribute(String name, Object value)
Error attributes can be used to add more information about the error.
The attributes can be use to format thedefault error messageanderror messages.- Parameters:
name-value-- See Also:
getAttribute(String),getMessage(),getErrorMessage(),getErrorMessage(String),BpmErrorBuilder.withAttribute(Object),BpmErrorBuilder.withAttribute(String, Object),BpmErrorBuilder.withAttributes(Map)- API:
- This public API is available in IvyScript and Java. It has the visibility ADVANCED.
-
getAttribute
public Object getAttribute(String name)
Error attributes can be used to provide more information about the error.
The attributes can be use to format thedefault error messageanderror messages.See
BpmError.AttributeNamesfor attributes that are available on errors provided by the system.- Parameters:
name-- Returns:
- attribute value or null
- See Also:
setAttribute(String, Object),getMessage(),getErrorMessage(),getErrorMessage(String),BpmErrorBuilder.withAttribute(Object),BpmErrorBuilder.withAttribute(String, Object),BpmErrorBuilder.withAttributes(Map),BpmError.AttributeNames- API:
- This public API is available in IvyScript and Java. It has the visibility ADVANCED.
-
getAttributeNames
public Set<String> getAttributeNames()
Error attributes can be used to provide more information about the error.
The attributes can be use to format thedefault error messageanderror messages.See
BpmError.AttributeNamesfor attributes that are available on errors provided by the system.- Returns:
- set with all names of available attributes.
- See Also:
setAttribute(String, Object),getAttribute(String),BpmErrorBuilder.withAttribute(Object),BpmErrorBuilder.withAttribute(String, Object),BpmErrorBuilder.withAttributes(Map),BpmError.AttributeNames- API:
- This public API is available in IvyScript and Java. It has the visibility ADVANCED.
-
getMessage
public String getMessage()
Returns the message of this error.
Use
getErrorMessage()to get a localized message for the end user.The message can be given when creating the error (see
BpmErrorBuilder.withMessage(String)) if not specified it is thegetErrorCode().Any attribute placeholder ({0}, {1}, etc) in the message are replaced with the corresponding
attributes.- See Also:
BpmErrorBuilder.withMessage(String),getErrorMessage(),getErrorMessage(String),BpmErrorBuilder.withMessage(String),BpmErrorBuilder.withCause(Throwable),setAttribute(String, Object),getAttribute(String),BpmErrorBuilder.withAttribute(Object),BpmErrorBuilder.withAttribute(String, Object)- API:
- This public API is available in IvyScript and Java. It has the visibility ADVANCED.
-
getErrorMessage
public String getErrorMessage()
Returns the error message of this error.
The error message is intended to be displayed to the end user. Therefore the error message for an error is normally stored in the CMS so that it can be translated to different languages.
For an error with the error code
ivy:error:databasethe error message is searched in the CMS in the following order and paths:/Errors/ivy/error/database/message/Errors/ivy/error/database/Errors/ivy/error/message/Errors/ivy/error/Errors/ivy/message/Errors/ivy
errorCodeand if available the message of thetechnical causeis returned instead.Any attribute placeholder ({0}, {1}, etc) in the message are replaced with the corresponding
attributes.- Returns:
- error message
- See Also:
getMessage(),getErrorMessage(String),setAttribute(String, Object),getAttribute(String),BpmErrorBuilder.withAttribute(Object),*- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
getErrorMessage
public String getErrorMessage(String messageName)
Returns the specific message with the given
messageNameof this error. For example ahelpor ahow to proceedtext.The specific message is intended to be displayed to the end user. Therefore specific messages for an error is normally stored in the CMS so that it can be translated to different languages.
For an error with the error code
ivy:error:databaseand themessageNamehelpthe error message is searched in the CMS in the following order and paths:/Errors/ivy/error/database/help/Errors/ivy/error/help/Errors/ivy/help
Any attribute placeholder ({0}, {1}, etc) in the message are replaced with the corresponding
attributes.- Parameters:
messageName- the name of the message to return- Returns:
- error message with the given
messageName - See Also:
getMessage(),getErrorMessage(),setAttribute(String, Object),getAttribute(String),BpmErrorBuilder.withAttribute(Object),BpmErrorBuilder.withAttribute(String, Object)- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
getProcessElement
public BpmProcessElement getProcessElement()
The process element that threw (caused) the error.- Returns:
- process element
- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
getProcessCallStack
public List<BpmStackFrame> getProcessCallStack()
The process call stack at the moment the error was thrown.
The process call stack is empty if the error was thrown in a top level process. If it was thrown in a callable process it contains all caller process elements.- Returns:
- process call stack. Maybe empty. Never null.
- API:
- This public API is available in IvyScript and Java. It has the visibility EXPERT.
-
-