Companion

object Companion

Functions

Link copied to clipboard
fun mergeCtx(l: IPersistentMap, r: Map<String, *>): IPersistentMap

Merge r's entries (string-keyed; each key gets interned to a Keyword) into l, returning a new persistent map. Used by Anomaly.mergeCtx implementations.

Link copied to clipboard
fun Throwable.toAnomaly(ctx: Map<String, *> = emptyMap<String, Any?>()): Anomaly

Convert a Throwable to the appropriate Anomaly subclass, attaching ctx as extra context data. An incoming Anomaly is wrapped in a fresh instance of the same category with the merged context, preserving the original as the cause.

Link copied to clipboard
inline fun <R> wrapAnomaly(ctx: Map<String, *> = emptyMap<String, Any?>(), block: () -> R): R

Run block, catching any Throwable and rethrowing as the appropriate Anomaly with ctx merged into its data. Mirrors xtdb.error/wrap-anomaly.