HandlerInterceptor
Wraps a single handler invocation attempt for Kotlin coroutine handlers. Implementations must call next() exactly once.
Errors visible to the interceptor
The interceptor sees all errors except protocol errors occurring during invocation processing, for example:
Request/Response serialization/deserialization failures.
If the user handler throws,
next()rethrows that exception unchanged.Errors from an innermost interceptor.
Transforming errors
Interceptors can catch an Exception from next() and rethrow a different one.
A common pattern is to convert known-unrecoverable exceptions (e.g. IllegalArgumentException from input validation) into TerminalException.
⚠ Never catch or remap AbortedExecutionException
AbortedExecutionException is an internal SDK control-flow signal used to abort the current execution attempt during journal replay and suspension. Remapping it will corrupt the state machine and produce non-deterministic behavior. If you catch it, rethrow it as it is.
Types
Per-invocation context exposed to a HandlerInterceptor.
Factory for HandlerInterceptor.