You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pekko.apache.org by he...@apache.org on 2024/03/18 09:55:02 UTC

(incubator-pekko) branch main updated: chore: Add a base termination for abrupt stream termination exceptions. (#1201)

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 5a0b2c1cfa chore: Add a base termination for abrupt stream termination exceptions. (#1201)
5a0b2c1cfa is described below

commit 5a0b2c1cfaec7f83ebe061298dd0adc4613a2835
Author: He-Pin(kerr) <he...@gmail.com>
AuthorDate: Mon Mar 18 17:54:57 2024 +0800

    chore: Add a base termination for abrupt stream termination exceptions. (#1201)
---
 .../scala/org/apache/pekko/stream/ActorMaterializer.scala   | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/stream/src/main/scala/org/apache/pekko/stream/ActorMaterializer.scala b/stream/src/main/scala/org/apache/pekko/stream/ActorMaterializer.scala
index baf70d9e2f..b692c3d313 100644
--- a/stream/src/main/scala/org/apache/pekko/stream/ActorMaterializer.scala
+++ b/stream/src/main/scala/org/apache/pekko/stream/ActorMaterializer.scala
@@ -267,14 +267,20 @@ abstract class ActorMaterializer extends Materializer with MaterializerLoggingPr
  */
 class MaterializationException(msg: String, cause: Throwable = null) extends RuntimeException(msg, cause)
 
+/**
+ * A base exception for abrupt stream termination.
+ */
+sealed class AbruptStreamTerminationException(msg: String, cause: Throwable = null)
+    extends RuntimeException(msg, cause)
+    with NoStackTrace
+
 /**
  * This exception signals that an actor implementing a Reactive Streams Subscriber, Publisher or Processor
  * has been terminated without being notified by an onError, onComplete or cancel signal. This usually happens
  * when an ActorSystem is shut down while stream processing actors are still running.
  */
 final case class AbruptTerminationException(actor: ActorRef)
-    extends RuntimeException(s"Processor actor [$actor] terminated abruptly")
-    with NoStackTrace
+    extends AbruptStreamTerminationException(s"Processor actor [$actor] terminated abruptly")
 
 /**
  * Signal that the operator was abruptly terminated, usually seen as a call to `postStop` of the `GraphStageLogic` without
@@ -282,9 +288,8 @@ final case class AbruptTerminationException(actor: ActorRef)
  * the actor running the graph is killed, which happens when the materializer or actor system is terminated.
  */
 final class AbruptStageTerminationException(logic: GraphStageLogic)
-    extends RuntimeException(
+    extends AbruptStreamTerminationException(
       s"GraphStage [$logic] terminated abruptly, caused by for example materializer or actor system termination.")
-    with NoStackTrace
 
 object ActorMaterializerSettings {
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pekko.apache.org
For additional commands, e-mail: commits-help@pekko.apache.org