object EitherTUtil
Utility functions for the cats
cats.data.EitherT monad transformer.
https://typelevel.org/cats/datatypes/eithert.html
- Alphabetic
- By Inheritance
- EitherTUtil
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- def condUnitET[F[_]]: CondUnitEitherTPartiallyApplied[F]
- def doNotAwait(eitherT: EitherT[Future, _, _], failureMessage: => String, level: Level = Level.ERROR)(implicit executionContext: ExecutionContext, loggingContext: ErrorLoggingContext): Unit
Discard
eitherT
and log an error if it does not result in aRight
.Discard
eitherT
and log an error if it does not result in aRight
. This is useful to document that anEitherT[Future,_,_]
is intentionally not being awaited upon. - def doNotAwaitUS(eitherT: EitherT[FutureUnlessShutdown, _, _], message: => String, failLevel: Level = Level.ERROR, shutdownLevel: Level = Level.DEBUG)(implicit executionContext: ExecutionContext, loggingContext: ErrorLoggingContext): Unit
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def fromFuture[E, A](fut: Future[A], errorHandler: (Throwable) => E)(implicit ec: ExecutionContext): EitherT[Future, E, A]
Construct an EitherT from a possibly failed future.
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def ifThenET[F[_], L](cond: Boolean)(then: => EitherT[F, L, _])(implicit F: Applicative[F]): EitherT[F, L, Unit]
Lifts an
if (cond) then ... else ()
into theEitherT
applicative - final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def leftSubflatMap[F[_], A, B, C, BB >: B](x: EitherT[F, A, B])(f: (A) => Either[C, BB])(implicit F: Functor[F]): EitherT[F, C, BB]
- def liftFailedFuture[E, A](fut: Future[Either[E, A]], errorHandler: (Throwable) => E)(implicit executionContext: ExecutionContext): EitherT[Future, E, A]
Lift a failed future into a Left value.
- def logOnError[E, R](result: EitherT[Future, E, R], message: String, level: Level = Level.ERROR)(implicit executionContext: ExecutionContext, loggingContext: ErrorLoggingContext): EitherT[Future, E, R]
Log
message
ifresult
fails with an exception or results in aLeft
- def logOnErrorU[E, R](result: EitherT[FutureUnlessShutdown, E, R], message: String, level: Level = Level.ERROR)(implicit executionContext: ExecutionContext, loggingContext: ErrorLoggingContext): EitherT[FutureUnlessShutdown, E, R]
Log
message
ifresult
fails with an exception or results in aLeft
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def onErrorOrFailure[A, B](errorHandler: () => Unit)(fn: => EitherT[Future, A, B])(implicit executionContext: ExecutionContext): EitherT[Future, A, B]
Similar to
finallyET
but will only call the provided handler iffn
returns a left/error or fails. - def onErrorOrFailureUnlessShutdown[A, B](errorHandler: () => Unit)(fn: => EitherT[FutureUnlessShutdown, A, B])(implicit executionContext: ExecutionContext): EitherT[FutureUnlessShutdown, A, B]
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def timed[E, R](timerMetric: Timer)(code: => EitherT[Future, E, R])(implicit executionContext: ExecutionContext): EitherT[Future, E, R]
Measure time of EitherT-based calls, inspired by upstream com.daml.metrics.Timed.future
- def toFuture[L <: Throwable, R](x: EitherT[Future, L, R])(implicit executionContext: ExecutionContext): Future[R]
Transform an EitherT into a Future.failed on left
Transform an EitherT into a Future.failed on left
Comes handy when having to return io.grpc.StatusRuntimeExceptions
- def toFutureUnlessShutdown[L <: Throwable, R](x: EitherT[FutureUnlessShutdown, L, R])(implicit executionContext: ExecutionContext): FutureUnlessShutdown[R]
- def toString(): String
- Definition Classes
- AnyRef → Any
- def unit[A]: EitherT[Future, A, Unit]
- def unitUS[A]: EitherT[FutureUnlessShutdown, A, Unit]
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])