Class BpmError
- All Implemented Interfaces:
ch.ivyteam.util.IIvyException
,Serializable
Provides information about an error that occured in the process.
Use create(String)
to create or throw a new BpmError
.
- See Also:
- API:
- This is a public API.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Defines names of attributes that are available on errors with certain error codes -
Method Summary
Modifier and TypeMethodDescriptionstatic BpmPublicErrorBuilder
To create a newerror
with the givenerrorCause
static BpmPublicErrorBuilder
To create a newerror
with the givenerrorCode
getAttribute
(String name) Error attributes can be used to provide more information about the error.
The attributes can be use to format thedefault error message
anderror messages
.Error attributes can be used to provide more information about the error.
The attributes can be use to format thedefault error message
anderror messages
.getCause()
Returns the cause of this error.Returns the error cause of the error.The error code is used to identify different kind of business errors.Returns the error message of this error.getErrorMessage
(String messageName) Returns the specific message with the givenmessageName
of this error.getId()
A unique error id.Returns the message of this error.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.The process element that threw (caused) the error.Returns the technical cause of the error.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 message
anderror messages
.
-
Method Details
-
create
To create a newerror
with the givenerrorCode
Examples:
BpmError.create("finance:nomoney").build()
BpmError.create("finance:nomoney").withMessage("There is no money left").build()
- Parameters:
errorCode
-- Returns:
- error builder
- See Also:
- API:
- This public API is available in Java.
-
create
To create a newerror
with the givenerrorCause
Examples:
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:
- API:
- This public API is available in Java.
-
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 Java.
-
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:
- API:
- This public API is available in Java.
-
getTechnicalCause
Returns the technical cause of the error.- Returns:
- Java exception that triggered the error handling. Maybe null.
- See Also:
- API:
- This public API is available in Java.
-
getErrorCause
Returns the error cause of the error.- Returns:
- the error that was the cause of this error. Maybe null.
- See Also:
- API:
- This public API is available in Java.
-
getCause
Returns the cause of this error.
This is either the
getErrorCause()
or thegetTechnicalCause()
or null.- See Also:
- API:
- This public API is available in Java.
-
setAttribute
Error attributes can be used to add more information about the error.
The attributes can be use to format thedefault error message
anderror messages
.- Parameters:
name
-value
-- See Also:
- API:
- This public API is available in Java.
-
getAttribute
Error attributes can be used to provide more information about the error.
The attributes can be use to format thedefault error message
anderror messages
.See
BpmError.AttributeNames
for attributes that are available on errors provided by the system.- Parameters:
name
-- Returns:
- attribute value or null
- See Also:
- API:
- This public API is available in Java.
-
getAttributeNames
Error attributes can be used to provide more information about the error.
The attributes can be use to format thedefault error message
anderror messages
.See
BpmError.AttributeNames
for attributes that are available on errors provided by the system.- Returns:
- set with all names of available attributes.
- See Also:
- API:
- This public API is available in Java.
-
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:
- API:
- This public API is available in Java.
-
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:database
the 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
/Errors/message
errorCode
and if available the message of thetechnical cause
is returned instead.Any attribute placeholder ({0}, {1}, etc) in the message are replaced with the corresponding
attributes
. Some elements, like the Rest Client Call, already have predefinedattributes
.- Returns:
- error message
- See Also:
- API:
- This public API is available in Java.
-
getErrorMessage
Returns the specific message with the given
messageName
of this error. For example ahelp
or ahow to proceed
text.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:database
and themessageName
help
the 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:
- API:
- This public API is available in Java.
-
getProcessElement
The process element that threw (caused) the error.- Returns:
- process element
- API:
- This public API is available in Java.
-
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 Java.
-