composeErrors

Deprecated

Niche use-case, prefer using higher level operators or addSuppressed from Kotlin Std

Replace with

res.fold({ first }, { e -> first.apply { addSuppressed(e) } })

fun composeErrors(first: Throwable, vararg rest: Throwable): Throwable

Deprecated

Niche use-case, prefer using higher level operators or addSuppressed from Kotlin Std

Replace with

first.apply { rest.forEach(::addSuppressed) }

Composes multiple errors together, meant for those cases in which error suppression, due to a second error being triggered, is not acceptable.

On top of the JVM this function uses Throwable#addSuppressed, available since Java 7. On top of JavaScript the function would return a CompositeException.


@JvmName(name = "composeErrorsNullable")
fun composeErrors(first: Throwable?, other: Throwable?): Throwable?

Deprecated

Niche use-case, prefer using higher level operators or addSuppressed from Kotlin Std

Replace with

first?.apply { other?.let(::addSuppressed) } ?: other

Composes multiple errors together, meant for those cases in which error suppression, due to a second error being triggered, is not acceptable.

On top of the JVM this function uses Throwable#addSuppressed, available since Java 7. On top of JavaScript the function would return a CompositeException.


Deprecated

Niche use-case, prefer using higher level operators or addSuppressed from Kotlin Std

Replace with

other?.apply { addSuppressed(first) } ?: first

Composes multiple errors together, meant for those cases in which error suppression, due to a second error being triggered, is not acceptable.

On top of the JVM this function uses Throwable#addSuppressed, available since Java 7. On top of JavaScript the function would return a CompositeException.


Deprecated

Niche use-case, prefer using higher level operators or addSuppressed from Kotlin Std

Replace with

all.head.apply { all.tail.forEach(::addSuppressed) }

Composes multiple errors together, meant for those cases in which error suppression, due to a second error being triggered, is not acceptable.

On top of the JVM this function uses Throwable#addSuppressed, available since Java 7. On top of JavaScript the function would return a CompositeException.


fun composeErrors(all: NonEmptyList<Throwable>): Throwable

Deprecated

Niche use-case, prefer using higher level operators or addSuppressed from Kotlin Std

Replace with

all.head.apply { all.tail.forEach(::addSuppressed) }