Attempt

io.eezo.db.Scopes.Attempt
final class Attempt[E <: Throwable]

The second half of attempt, split off only so the caller names E and A is inferred.

The failure is judged by a TypeTest rather than a ClassTag because a union such as SQLException | TimeoutException has no single class: its ClassTag is the common superclass, Exception, and would quietly own every defect the caller never named.

The type stays public, so a caller can hold one and call apply, but the constructor does not: a public one would let new Attempt[Throwable] or new Attempt[Nothing] build the same unguarded savepoint that attempt's summonFrom refuses to hand out. publicInBinary is there only because attempt is inline and expands new Attempt[E] at the call site: Scala refuses to inline a private constructor without it, so attempt itself would not compile.

Attributes

Source
Scopes.scala
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def apply[A](body: Tx ?=> A)(using tx: Tx): Either[E, A]

The savepoint is rolled back before the failure is judged, so the sub unit's writes are gone whether it comes back as a Left or keeps travelling. If that rollback fails the transaction is no longer where the caller thinks, so nothing is owned: the body's failure travels on, carrying the rollback's as suppressed.

The savepoint is rolled back before the failure is judged, so the sub unit's writes are gone whether it comes back as a Left or keeps travelling. If that rollback fails the transaction is no longer where the caller thinks, so nothing is owned: the body's failure travels on, carrying the rollback's as suppressed.

Attributes

Source
Scopes.scala