Finalization

zio.blocks.scope.Finalization
See theFinalization companion object
final class Finalization(val errors: Chunk[Throwable])

The result of running finalizers, collecting any errors that occurred.

When a scope closes, each registered finalizer runs in LIFO order. Finalizers that throw are caught and their exceptions are collected into a Finalization. This type provides convenient methods for inspecting and re-throwing those errors.

Value parameters

errors

the errors collected from running finalizers

Attributes

Companion
object
Source
Finalization.scala
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def isEmpty: Boolean

Returns true if no finalizer errors were collected.

Returns true if no finalizer errors were collected.

Attributes

Source
Finalization.scala
def nonEmpty: Boolean

Returns true if at least one finalizer error was collected.

Returns true if at least one finalizer error was collected.

Attributes

Source
Finalization.scala
def orThrow(): Unit

Throws the first collected error with all remaining errors added as suppressed. Does nothing if there are no errors.

Throws the first collected error with all remaining errors added as suppressed. Does nothing if there are no errors.

The first error corresponds to the head of the chunk (the first finalizer that failed in LIFO execution order).

Attributes

Source
Finalization.scala
def suppress(initial: Throwable): Throwable

Adds all collected errors as suppressed exceptions to initial and returns it. If there are no errors, initial is returned unchanged.

Adds all collected errors as suppressed exceptions to initial and returns it. If there are no errors, initial is returned unchanged.

Value parameters

initial

the primary throwable to attach suppressed exceptions to

Attributes

Returns

initial, with any finalizer errors added as suppressed

Source
Finalization.scala

Concrete fields

val errors: Chunk[Throwable]

Attributes

Source
Finalization.scala