This is an automated email from the ASF dual-hosted git repository.
hepin pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-pekko.git
The following commit(s) were added to refs/heads/main by this push:
new 23b81b2f22 =str Make use of applyOrElse in MapError operator.
23b81b2f22 is described below
commit 23b81b2f221c65c86798329716d8ed69c51a741d
Author: He-Pin <[email protected]>
AuthorDate: Sat Sep 2 22:13:49 2023 +0800
=str Make use of applyOrElse in MapError operator.
---
.../src/main/scala/org/apache/pekko/stream/impl/fusing/Ops.scala | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git
a/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/Ops.scala
b/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/Ops.scala
index a1c839889f..05f864c2e3 100644
--- a/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/Ops.scala
+++ b/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/Ops.scala
@@ -342,10 +342,13 @@ private[stream] object Collect {
override def createLogic(attr: Attributes) =
new GraphStageLogic(shape) with InHandler with OutHandler {
override def onPush(): Unit = push(out, grab(in))
+ import Collect.NotApplied
- override def onUpstreamFailure(ex: Throwable): Unit =
- if (f.isDefinedAt(ex)) super.onUpstreamFailure(f(ex))
- else super.onUpstreamFailure(ex)
+ override def onUpstreamFailure(ex: Throwable): Unit = f.applyOrElse(ex,
NotApplied) match {
+ case NotApplied => super.onUpstreamFailure(ex)
+ case t: Throwable => super.onUpstreamFailure(t)
+ case _ => throw new IllegalStateException() // won't
happen, compiler exhaustiveness check pleaser
+ }
override def onPull(): Unit = pull(in)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]