Skip to content

Should the Decider of stream be a Function2? #2288

@He-Pin

Description

@He-Pin

Motivation:
With the current type Decider = Function[Throwable, Directive] , we can not know the current element that causes the exception, I think it would be better to be type Decider = Function2[Throwable,Any, Directive]

eg, The Map operator then will be:

      override def onPush(): Unit = {
        val current = grab(in)
        try {
          push(out, f(current))
        } catch {
          case NonFatal(ex) =>
            decider(ex, current) match {
              case Supervision.Stop => failStage(ex)
              case _                => pull(in)
            }
        }
      }

@mdedetrich @raboof @pjfanning wdyt?

We can see in reactor-core's Flux:

	public final Flux<T> onErrorComplete(Predicate<? super Throwable> predicate) {

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions