Record Class WorkflowError
java.lang.Object
java.lang.Record
io.axoniq.framework.workflow.dsl.api.WorkflowError
- Record Components:
type- fully-qualified name of the originating throwable's class.message- message of the originating throwable, truncated toTRUNCATED_MESSAGE_SIZEcharacters, ornull.cause- compacted cause, ornull.
- All Implemented Interfaces:
Cause
@Internal
public record WorkflowError(String type, @Nullable String message, @Nullable WorkflowError cause)
extends Record
implements Cause
Compact, serialization-friendly representation of a
Throwable stored in workflow events.
Captures only the exception class name and message — the stack trace is deliberately omitted to keep event-store payloads small and avoid bytecode-incompatibility issues across JVM versions. The full stack trace is still available through the executor logs when the failure occurs.
- Since:
- 5.4.0
- Author:
- Stefan Dragisic
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intMaximum number of cause-chain levels captured.static final intMaximum length ofmessage()characters. -
Constructor Summary
ConstructorsConstructorDescriptionWorkflowError(String type, @Nullable String message, @Nullable WorkflowError cause) Creates an instance of aWorkflowErrorrecord class. -
Method Summary
Modifier and TypeMethodDescription@Nullable WorkflowErrorcause()Returns the value of thecauserecord component.final booleanIndicates whether some other object is "equal to" this one.static @Nullable WorkflowErrorCompacts the given throwable and its cause chain (up toMAX_CAUSE_DEPTHlevels) into a .final inthashCode()Returns a hash code value for this object.@Nullable Stringmessage()Returns the value of themessagerecord component.final StringtoString()Returns a string representation of this record class.Rebuilds an exception chain from this compact representation.type()Returns the value of thetyperecord component.
-
Field Details
-
MAX_CAUSE_DEPTH
public static final int MAX_CAUSE_DEPTHMaximum number of cause-chain levels captured. Protects against deep chains.- See Also:
-
TRUNCATED_MESSAGE_SIZE
public static final int TRUNCATED_MESSAGE_SIZEMaximum length ofmessage()characters.- See Also:
-
-
Constructor Details
-
Method Details
-
from
Compacts the given throwable and its cause chain (up toMAX_CAUSE_DEPTHlevels) into a . Messages longer thanTRUNCATED_MESSAGE_SIZEare truncated. Cycles are broken via identity tracking.- Parameters:
throwable- throwable to compact, may benull.- Returns:
- compacted representation, or
nullifthrowableisnull.
-
toThrowable
Rebuilds an exception chain from this compact representation.Exceptions thrown by a step body are rebuilt as a stackless
WorkflowExecutionExceptioncarrying the original exception class FQN and message. The engine-raisedStepIndeterminateExceptionis rebuilt as its own type, so a workflow body can catch it after replay exactly as during the run that recorded it. The cause (if any) is reconstructed the same way.- Returns:
- reconstructed exception.
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
type
Returns the value of thetyperecord component. -
message
Returns the value of themessagerecord component. -
cause
Returns the value of thecauserecord component.- Returns:
- the value of the
causerecord component
-