Enum Class EventErrorPolicy
- All Implemented Interfaces:
Serializable,Comparable<EventErrorPolicy>,Constable
This policy is set via
CopilotSession.setEventErrorPolicy(EventErrorPolicy) and determines
whether remaining event listeners continue to execute after a preceding
listener throws an exception. Errors are always logged at
Level.WARNING regardless of the policy.
The configured EventErrorHandler (if any) is always invoked
regardless of the policy — the policy only controls whether dispatch
continues after the error has been logged and the error handler has been
called.
The naming follows the convention used by Spring Framework's
TaskUtils.LOG_AND_SUPPRESS_ERROR_HANDLER and
TaskUtils.LOG_AND_PROPAGATE_ERROR_HANDLER.
Example:
// Default: propagate errors (stop dispatch on first error, log the error)
session.setEventErrorPolicy(EventErrorPolicy.PROPAGATE_AND_LOG_ERRORS);
// Opt-in to suppress errors (continue dispatching, log each error)
session.setEventErrorPolicy(EventErrorPolicy.SUPPRESS_AND_LOG_ERRORS);
- Since:
- 1.0.8
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionPropagate errors: log the error and stop dispatch on first listener error (default).Suppress errors: log the error and continue dispatching to remaining listeners. -
Method Summary
Modifier and TypeMethodDescriptionstatic EventErrorPolicyReturns the enum constant of this class with the specified name.static EventErrorPolicy[]values()Returns an array containing the constants of this enum class, in the order they are declared.Methods inherited from class java.lang.Enum
compareTo, describeConstable, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
-
Enum Constant Details
-
SUPPRESS_AND_LOG_ERRORS
Suppress errors: log the error and continue dispatching to remaining listeners.When a handler throws an exception, the error is logged at
Level.WARNINGand remaining handlers still execute. The configuredEventErrorHandleris called for each error. This is analogous to Spring'sLOG_AND_SUPPRESS_ERROR_HANDLERbehavior. -
PROPAGATE_AND_LOG_ERRORS
Propagate errors: log the error and stop dispatch on first listener error (default).When a handler throws an exception, the error is logged at
Level.WARNINGand no further handlers are invoked. The configuredEventErrorHandleris still called before dispatch stops. This is analogous to Spring'sLOG_AND_PROPAGATE_ERROR_HANDLERbehavior.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-