Why is the exception in
import akka.actor.ActorSystem
import akka.stream.ActorMaterializer
import akka.stream.scaladsl.Source
object TestExceptionHandling {
d
I had similar questions when I started using akk-streams. Supervision.Decider
helps but not always.
Unfortunately it doesn't catch exceptions thrown in ActionPublisher
. I see it handled, ActorPublisher.onError
is called but it doesn't reach Supervision.Decider
. It works with simple Stream provided in documentation.
Errors also don't reach actor if I use Sink.actorRef
.
And for the sake of experiment I tried following sample
val stream = Source(0 to 5).map(100 / _)
stream.runWith(Sink.actorSubscriber(props))
In this case exception was caught by Decider but never reached actor subscriber.
Overall I think it's inconsistent behavior. I cannot use one mechanism for handling errors in Stream.
My original SO question: Custom Supervision.Decider doesn't catch exception produced by ActorPublisher
And here is akka issue where it's tracked: https://github.com/akka/akka/issues/18359