final case class Error(ex: Throwable) extends Attempt[Nothing] with Product with Serializable
Constructs an eager Coeval instance for a result that represents an error.
- Source
- Coeval.scala
- Alphabetic
- By Inheritance
- Error
- Attempt
- Product
- Equals
- Coeval
- Serializable
- Serializable
- Function0
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new Error(ex: Throwable)
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
-
def
apply(): Nothing
Evaluates the underlying computation and returns the result.
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
final
def
asScala: Try[Nothing]
Converts this attempt into a
scala.util.Try
.Converts this attempt into a
scala.util.Try
.- Definition Classes
- Attempt
-
def
attempt: Coeval[Either[Throwable, Nothing]]
Creates a new Coeval that will expose any triggered error from the source.
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
def
dematerialize[B](implicit ev: <:<[Nothing, Try[B]]): Coeval[B]
Dematerializes the source's result from a
Try
.Dematerializes the source's result from a
Try
.- Definition Classes
- Coeval
-
def
doOnFinish(f: (Option[Throwable]) ⇒ Coeval[Unit]): Coeval[Nothing]
Returns a new
Coeval
in whichf
is scheduled to be run on completion.Returns a new
Coeval
in whichf
is scheduled to be run on completion. This would typically be used to release any resources acquired by thisCoeval
.- Definition Classes
- Coeval
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- val ex: Throwable
-
def
failed: Attempt[Throwable]
Returns a failed projection of this coeval.
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
flatMap[B](f: (Nothing) ⇒ Coeval[B]): Coeval[B]
Creates a new
Coeval
by applying a function to the successful result of the source, and returns a new instance equivalent to the result of the function.Creates a new
Coeval
by applying a function to the successful result of the source, and returns a new instance equivalent to the result of the function.- Definition Classes
- Coeval
-
def
flatten[B](implicit ev: <:<[Nothing, Coeval[B]]): Coeval[B]
Given a source Coeval that emits another Coeval, this function flattens the result, returning a Coeval equivalent to the emitted Coeval by the source.
Given a source Coeval that emits another Coeval, this function flattens the result, returning a Coeval equivalent to the emitted Coeval by the source.
- Definition Classes
- Coeval
-
def
foreach(f: (Nothing) ⇒ Unit): Unit
Triggers the evaluation of the source, executing the given function for the generated element.
Triggers the evaluation of the source, executing the given function for the generated element.
The application of this function has strict behavior, as the coeval is immediately executed.
- Definition Classes
- Coeval
-
def
foreachL(f: (Nothing) ⇒ Unit): Coeval[Unit]
Returns a new task that upon evaluation will execute the given function for the generated element, transforming the source into a
Coeval[Unit]
. -
final
def
get: Nothing
Retrieve the (successful) value or throw the error.
Retrieve the (successful) value or throw the error.
Alias for Coeval.value.
- Definition Classes
- Attempt
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isError: Boolean
Returns true if result is an error.
Returns true if result is an error.
- Definition Classes
- Attempt
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
isSuccess: Boolean
Returns true if value is a successful one.
Returns true if value is a successful one.
- Definition Classes
- Attempt
-
def
map[B](f: (Nothing) ⇒ B): Coeval[B]
Returns a new Coeval that applies the mapping function to the element emitted by the source.
Returns a new Coeval that applies the mapping function to the element emitted by the source.
- Definition Classes
- Coeval
-
def
materialize: Coeval[Try[Nothing]]
Creates a new Coeval that will expose any triggered error from the source.
-
final
def
memoize: Attempt[Nothing]
Memoizes (caches) the result of the source and reuses it on subsequent invocations of
value
.Memoizes (caches) the result of the source and reuses it on subsequent invocations of
value
.The resulting coeval will be idempotent, meaning that evaluating the resulting coeval multiple times will have the same effect as evaluating it once.
- Definition Classes
- Attempt → Coeval
- See also
memoizeOnSuccess for a version that only caches successful results
-
def
memoizeOnSuccess: Coeval[Nothing]
Memoizes (cache) the successful result of the source and reuses it on subsequent invocations of
value
.Memoizes (cache) the successful result of the source and reuses it on subsequent invocations of
value
. Thrown exceptions are not cached.The resulting coeval will be idempotent, but only if the result is successful.
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
onErrorFallbackTo[B >: Nothing](that: Coeval[B]): Coeval[B]
Creates a new coeval that in case of error will fallback to the given backup coeval.
Creates a new coeval that in case of error will fallback to the given backup coeval.
- Definition Classes
- Coeval
-
def
onErrorHandle[U >: Nothing](f: (Throwable) ⇒ U): Coeval[U]
Creates a new coeval that will handle any matching throwable that this coeval might emit.
Creates a new coeval that will handle any matching throwable that this coeval might emit.
See onErrorRecover for the version that takes a partial function.
- Definition Classes
- Coeval
-
def
onErrorHandleWith[B >: Nothing](f: (Throwable) ⇒ Coeval[B]): Coeval[B]
Creates a new coeval that will handle any matching throwable that this coeval might emit by executing another coeval.
Creates a new coeval that will handle any matching throwable that this coeval might emit by executing another coeval.
See onErrorRecoverWith for the version that takes a partial function.
- Definition Classes
- Coeval
-
def
onErrorRecover[U >: Nothing](pf: PartialFunction[Throwable, U]): Coeval[U]
Creates a new coeval that on error will try to map the error to another value using the provided partial function.
Creates a new coeval that on error will try to map the error to another value using the provided partial function.
See onErrorHandle for the version that takes a total function.
- Definition Classes
- Coeval
-
def
onErrorRecoverWith[B >: Nothing](pf: PartialFunction[Throwable, Coeval[B]]): Coeval[B]
Creates a new coeval that will try recovering from an error by matching it with another coeval using the given partial function.
Creates a new coeval that will try recovering from an error by matching it with another coeval using the given partial function.
See onErrorHandleWith for the version that takes a total function.
- Definition Classes
- Coeval
-
def
onErrorRestart(maxRetries: Long): Coeval[Nothing]
Creates a new coeval that in case of error will retry executing the source again and again, until it succeeds.
Creates a new coeval that in case of error will retry executing the source again and again, until it succeeds.
In case of continuous failure the total number of executions will be
maxRetries + 1
.- Definition Classes
- Coeval
-
def
onErrorRestartIf(p: (Throwable) ⇒ Boolean): Coeval[Nothing]
Creates a new coeval that in case of error will retry executing the source again and again, until it succeeds.
Creates a new coeval that in case of error will retry executing the source again and again, until it succeeds.
In case of continuous failure the total number of executions will be
maxRetries + 1
.- Definition Classes
- Coeval
-
def
restartUntil(p: (Nothing) ⇒ Boolean): Coeval[Nothing]
Given a predicate function, keep retrying the coeval until the function returns true.
Given a predicate function, keep retrying the coeval until the function returns true.
- Definition Classes
- Coeval
-
def
run: Either[Throwable, Nothing]
Evaluates the underlying computation and returns the result or any triggered errors as a Scala
Either
, whereRight(_)
is for successful values andLeft(_)
is for thrown errors.Evaluates the underlying computation and returns the result or any triggered errors as a Scala
Either
, whereRight(_)
is for successful values andLeft(_)
is for thrown errors.- Definition Classes
- Coeval
-
def
runAttempt: Error
Evaluates the underlying computation and returns the result or any triggered errors as a Coeval.Attempt.
Evaluates the underlying computation and returns the result or any triggered errors as a Coeval.Attempt.
-
def
runTry: Try[Nothing]
Evaluates the underlying computation and returns the result or any triggered errors as a
scala.util.Try
.Evaluates the underlying computation and returns the result or any triggered errors as a
scala.util.Try
.- Definition Classes
- Coeval
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
- def task: Task[Nothing]
-
def
toString(): String
- Definition Classes
- Function0 → AnyRef → Any
-
def
transform[R](fa: (Nothing) ⇒ R, fe: (Throwable) ⇒ R): Coeval[R]
Creates a new
Coeval
by applying the 'fa' function to the successful result of this future, or the 'fe' function to the potential errors that might happen.Creates a new
Coeval
by applying the 'fa' function to the successful result of this future, or the 'fe' function to the potential errors that might happen.This function is similar with map, except that it can also transform errors and not just successful results.
- fa
function that transforms a successful result of the receiver
- fe
function that transforms an error of the receiver
- Definition Classes
- Coeval
-
def
transformWith[R](fa: (Nothing) ⇒ Coeval[R], fe: (Throwable) ⇒ Coeval[R]): Coeval[R]
Creates a new
Coeval
by applying the 'fa' function to the successful result of this future, or the 'fe' function to the potential errors that might happen.Creates a new
Coeval
by applying the 'fa' function to the successful result of this future, or the 'fe' function to the potential errors that might happen.This function is similar with flatMap, except that it can also transform errors and not just successful results.
- fa
function that transforms a successful result of the receiver
- fe
function that transforms an error of the receiver
- Definition Classes
- Coeval
-
def
value: Nothing
Evaluates the underlying computation and returns the result.
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
def
zip[B](that: Coeval[B]): Coeval[(Nothing, B)]
Zips the values of
this
andthat
coeval, and creates a new coeval that will emit the tuple of their results.Zips the values of
this
andthat
coeval, and creates a new coeval that will emit the tuple of their results.- Definition Classes
- Coeval
-
def
zipMap[B, C](that: Coeval[B])(f: (Nothing, B) ⇒ C): Coeval[C]
Zips the values of
this
andthat
and applies the given mapping function on their results.Zips the values of
this
andthat
and applies the given mapping function on their results.- Definition Classes
- Coeval
Deprecated Value Members
-
final
def
dematerializeAttempt[B](implicit ev: <:<[Nothing, Attempt[B]]): Attempt[B]
Dematerializes the source's result from a Coeval.Attempt.
Dematerializes the source's result from a Coeval.Attempt.
Deprecated, please use Coeval#dematerialize or just flatMap.
The reason for the deprecation is the naming alignment with the Cats ecosystem, where
Attempt
is being used as an alias forEither[Throwable, A]
. -
final
def
isFailure: Boolean
Returns true if result is an error.
Returns true if result is an error.
Deprecated, renamed to Coeval.Attempt#isError.
- Definition Classes
- Attempt
- Annotations
- @deprecated
- Deprecated
(Since version 2.3.0) Use Coeval.Attempt#isError
-
final
def
materializeAttempt: Attempt[Attempt[Nothing]]
Creates a new Coeval that will expose any triggered error from the source.
Creates a new Coeval that will expose any triggered error from the source.
Deprecated, please use Coeval#attempt or Coeval#materialize.
The reason for the deprecation is the naming alignment with the Cats ecosystem, where
Attempt
is being used as an alias forEither[Throwable, A]
.
This is the API documentation for the Monix library.
Package Overview
monix.execution exposes lower level primitives for dealing with asynchronous execution:
Atomic
types, as alternative tojava.util.concurrent.atomic
monix.eval is for dealing with evaluation of results, thus exposing Task and Coeval.
monix.reactive exposes the
Observable
pattern:Observable
implementationsmonix.types implements type-class shims, to be translated to type-classes provided by libraries such as Cats or Scalaz.
monix.cats is the optional integration with the Cats library, providing translations for the types described in
monix.types
.monix.scalaz is the optional integration with the Scalaz library, providing translations for the types described in
monix.types
.