Packages

final case class Safe[-I, +O, +E](alterand: Stage[I, O, E]) extends Alterator[Stage[I, O, E], I, O, Either[Throwable, E]] with SafeStage[I, O, Either[Throwable, E]] with Product with Serializable

A decorator that catches non-fatal exceptions thrown by the inner stage and converts them into h8io.stages.Status.Complete error values.

The error type is widened from E to Either[Throwable, E]:

  • Errors already carried by the inner stage are wrapped as Right(e).
  • Exceptions caught during apply are reported as Left(throwable) in a Yield.None(Status.error(Left(e)), this).

Only non-fatal exceptions (matched by scala.util.control.NonFatal) are caught; fatal errors such as OutOfMemoryError propagate normally.

The evolution is mapped so that every continuation stage remains wrapped in Safe, maintaining exception safety across the entire pipeline.

I

the input type (contravariant)

O

the output type (covariant)

E

the original error type of the inner stage (covariant)

alterand

the inner stage whose exceptions should be caught

Source
Safe.scala
Linear Supertypes
Serializable, Product, Equals, SafeStage[I, O, Either[Throwable, E]], Alterator[Stage[I, O, E], I, O, Either[Throwable, E]], Stage[I, O, Either[Throwable, E]], (I) => Yield[I, O, Either[Throwable, E]], AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Safe
  2. Serializable
  3. Product
  4. Equals
  5. SafeStage
  6. Alterator
  7. Stage
  8. Function1
  9. AnyRef
  10. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new Safe(alterand: Stage[I, O, E])

    alterand

    the inner stage whose exceptions should be caught

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. val alterand: Stage[I, O, E]

    The wrapped stage whose behavior is modified by this operator.

    The wrapped stage whose behavior is modified by this operator.

    Definition Classes
    SafeAlterator
  5. def andThen[A](g: (Yield[I, O, Either[Throwable, E]]) => A): (I) => A
    Definition Classes
    Function1
    Annotations
    @unspecialized()
  6. final def apply(in: I): Yield[I, O, Either[Throwable, E]]

    Applies this stage to the given input, producing a Yield.

    Applies this stage to the given input, producing a Yield.

    in

    the input value

    returns

    a Yield containing the optional output, status, and evolution

    Definition Classes
    SafeStageStage → Function1
  7. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  8. def body(in: I): Yield[I, O, Either[Throwable, E]]

    The main execution logic invoked on each input.

    The main execution logic invoked on each input.

    in

    the input value

    returns

    a h8io.stages.Yield representing the result

    Definition Classes
    SafeSafeStage
  9. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
  10. def compose[A](g: (A) => I): (A) => Yield[I, O, Either[Throwable, E]]
    Definition Classes
    Function1
    Annotations
    @unspecialized()
  11. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  12. final def execute(in: I): Outcome[O, Either[Throwable, E]]

    Executes this stage end-to-end and returns a plain Outcome.

    Executes this stage end-to-end and returns a plain Outcome.

    Internally this method:

    1. Applies the stage to in, obtaining a Yield.
    2. Disposes the Evolution carried by the Yield — since execute is a terminal operation, the continuation is not needed and the resources held by this stage must be released immediately.
    3. Wraps the result in an Outcome.Some or Outcome.None.

    Disposal failures do not prevent the result from being returned. Any non-fatal exception raised by Evolution.dispose is captured in Outcome.disposeFailure and the outcome is still produced. Fatal exceptions are not caught and will propagate.

    in

    the input value

    returns

    Outcome.Some if this stage produced an output, Outcome.None otherwise

    Definition Classes
    Stage
    Annotations
    @inline()
  13. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @IntrinsicCandidate() @native()
  14. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  15. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  16. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate() @native()
  17. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate() @native()
  18. def productElementNames: Iterator[String]
    Definition Classes
    Product
  19. def recover(in: I, e: Throwable): Yield[I, O, Either[Throwable, E]]

    Called when body throws a non-fatal exception.

    Called when body throws a non-fatal exception.

    in

    the input value that was being processed when the exception occurred

    e

    the non-fatal exception thrown by body

    returns

    a h8io.stages.Yield representing the error outcome

    Definition Classes
    SafeSafeStage
  20. def skip(): Evolution[I, O, Either[Throwable, E]]

    Returns the Evolution for this stage without processing any input.

    Returns the Evolution for this stage without processing any input.

    Any stage that participates in a pipeline run but does not process the current input must call skip() instead of apply. Common triggers: an upstream stage produced no output (Yield.None), or a non-inclusive binary operation excluded this branch. The stage must return its Evolution as it would have appeared had it run, but must not perform any side effects or consume input.

    See the Lifecycle section in Stage for the full contract.

    returns

    the Evolution representing how the pipeline should continue from this stage

    Definition Classes
    SafeStage
  21. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  22. def toString(): String
    Definition Classes
    Function1 → AnyRef → Any
  23. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  24. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  25. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  26. final def ~>[_O, _E >: Either[Throwable, E]](that: Stage[O, _O, _E]): Stage[I, _O, _E]

    Composes this stage with that, producing a new stage that feeds the output of this stage into that.

    Composes this stage with that, producing a new stage that feeds the output of this stage into that.

    The resulting Stage.AndThen feeds the output of this stage into that. If this stage produces an output, the statuses and evolutions of both stages are merged; if it produces no output, only the evolutions are composed and that is not invoked for the current input.

    _O

    the output type of the composed pipeline

    _E

    the combined error type (must be a supertype of E)

    that

    the stage to execute after this one

    returns

    a composed stage this ~> that

    Definition Classes
    Stage
    Annotations
    @inline()

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

    (Since version 9)

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from SafeStage[I, O, Either[Throwable, E]]

Inherited from Alterator[Stage[I, O, E], I, O, Either[Throwable, E]]

Inherited from Stage[I, O, Either[Throwable, E]]

Inherited from (I) => Yield[I, O, Either[Throwable, E]]

Inherited from AnyRef

Inherited from Any

Ungrouped