apache / apache/pekko

Should the Decider of stream be a Function2?

Open
#2,288 2 comments 0 reactions 0 assignees View on GitHub
t:stream
Dominant language
Scala
Stars
1.6k
Forks
211
Avg merge
1d 6h
Merged PRs (30d)
89

Description

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:

```scala
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:
```java
public final Flux onErrorComplete(Predicate predicate) {

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.