Add ExceptionCollector.throwLast

This commit is contained in:
Him188 2021-05-09 01:24:31 +08:00
parent c9a3bb23ee
commit a62c570205

View File

@ -64,6 +64,11 @@ public class ExceptionCollector : Sequence<Throwable> {
throw getLast()!!
}
@TerminalOperation
public fun throwLast(): Nothing {
throw getLast() ?: error("Internal error: expected at least one exception collected.")
}
@DslMarker
private annotation class TerminalOperation