Skip to content

Commit

Permalink
chore: Add a base termination for abrupt stream termination exception…
Browse files Browse the repository at this point in the history
…s. (#1201)
  • Loading branch information
He-Pin authored Mar 18, 2024
1 parent 5376692 commit 5a0b2c1
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -267,24 +267,29 @@ 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
* any of the handler callbacks seeing completion or failure from upstream or cancellation from downstream. This can happen when
* 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 {

Expand Down

0 comments on commit 5a0b2c1

Please sign in to comment.