Package com.tnsai.hooks.events
Record Class OnActionError
java.lang.Object
java.lang.Record
com.tnsai.hooks.events.OnActionError
- Record Components:
eventId- ULID-shaped correlation idtimestamp- when the event was constructed (post-throw)context- surrounding hook contextrequest- typed request that failedcause- the throwable that ended the invocationtype- dispatch channelattempt- 1-based attempt counterretryable- framework-classified retryability
- All Implemented Interfaces:
ActionHookEvent,HookEvent
public record OnActionError(String eventId, Instant timestamp, HookContext context, ActionRequest request, Throwable cause, ActionType type, int attempt, boolean retryable)
extends Record
implements ActionHookEvent
Fires when an action throws during execution (issue #59). Counterpart
to
at the broader
invalid reference
OnToolError
ActionHookEvent
boundary — catches LLM / MCP / WEB_SERVICE / LOCAL errors too, not
only Tool SPI throws.
attempt is 1-based. retryable reflects the
framework's classification of the cause (via
TnsAIException.isRetryable() when
applicable).
- Since:
- 0.5.0 (issue #59)
-
Constructor Summary
ConstructorsConstructorDescriptionOnActionError(String eventId, Instant timestamp, HookContext context, ActionRequest request, Throwable cause, ActionType type, int attempt, boolean retryable) Creates an instance of aOnActionErrorrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintattempt()Returns the value of theattemptrecord component.cause()Returns the value of thecauserecord component.context()Returns the value of thecontextrecord component.final booleanIndicates whether some other object is "equal to" this one.eventId()Returns the value of theeventIdrecord component.Short stable string identifier of the event kind, e.g.final inthashCode()Returns a hash code value for this object.request()Returns the value of therequestrecord component.booleanReturns the value of theretryablerecord component.Returns the value of thetimestamprecord component.final StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.
-
Constructor Details
-
OnActionError
public OnActionError(String eventId, Instant timestamp, HookContext context, ActionRequest request, Throwable cause, ActionType type, int attempt, boolean retryable) Creates an instance of aOnActionErrorrecord class.- Parameters:
eventId- the value for theeventIdrecord componenttimestamp- the value for thetimestamprecord componentcontext- the value for thecontextrecord componentrequest- the value for therequestrecord componentcause- the value for thecauserecord componenttype- the value for thetyperecord componentattempt- the value for theattemptrecord componentretryable- the value for theretryablerecord component
-
-
Method Details
-
eventType
Description copied from interface:HookEventShort stable string identifier of the event kind, e.g."PreToolUse". Default implementation derives it from the concrete record's simple class name; concrete records may override if a different naming is desirable. -
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
eventId
Returns the value of theeventIdrecord component. -
timestamp
Returns the value of thetimestamprecord component. -
context
Returns the value of thecontextrecord component. -
request
Returns the value of therequestrecord component.- Returns:
- the value of the
requestrecord component
-
cause
Returns the value of thecauserecord component.- Returns:
- the value of the
causerecord component
-
type
Returns the value of thetyperecord component.- Returns:
- the value of the
typerecord component
-
attempt
public int attempt()Returns the value of theattemptrecord component.- Returns:
- the value of the
attemptrecord component
-
retryable
public boolean retryable()Returns the value of theretryablerecord component.- Returns:
- the value of the
retryablerecord component
-