KbEventListener

abstract class KbEventListener(source)

A caller-supplied observer that is notified of soft failures during a KbTemplate render.

Register an instance through KbEnvironmentBuilder.eventListener (available on KbEnvironment.create, KbEnvironment.fromJson, and KbEnvironment.fromYaml). When no listener is registered, soft failures are not reported and rendering behaves exactly as it did before listeners existed.

Implementations should be cheap and must not throw: a listener runs in the middle of rendering, so a thrown exception would abort the render. Use the KbSoftFailEvent.severity to decide what to surface — for example, log KbSoftFailEvent.Severity.Warning events but ignore KbSoftFailEvent.Severity.Info ones.

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
object Companion

Provides the shared no-op listener used as the default when no listener is registered.

Functions

Link copied to clipboard
abstract fun onSoftFail(event: KbSoftFailEvent)

Called once for each soft failure encountered during a render, in render order.