toAnomaly

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.

Mirrors xtdb.error/->anomaly; keep them in sync until the remaining Clojure callers move across.