stream: don't wrap exceptions in ByteStringParser (#31311)

This commit is contained in:
Johannes Rudolph 2022-04-04 15:43:53 +02:00 committed by GitHub
parent 30ff7866ee
commit 9ac594e637
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View file

@ -7,7 +7,6 @@ package tcp
import scala.util.Random
import akka.stream.impl.io.ByteStringParser.ParsingException
import akka.stream.scaladsl.Flow
import akka.stream.scaladsl.Framing.FramingException
import akka.stream.scaladsl.Sink
@ -62,8 +61,7 @@ class TcpFramingSpec extends AkkaSpec("""
"reject invalid magic" in {
val bytes = frameBytes(2)
val fail = Source(List(bytes)).via(framingFlow).runWith(Sink.seq).failed.futureValue
fail shouldBe a[ParsingException]
fail.getCause shouldBe a[FramingException]
fail shouldBe a[FramingException]
}
"include streamId in each frame" in {

View file

@ -80,7 +80,7 @@ import akka.util.ByteString
DontRecurse
case NonFatal(ex) =>
failStage(new ParsingException(s"Parsing failed in step $current", ex))
failStage(ex)
DontRecurse
}
@ -177,6 +177,7 @@ import akka.util.ByteString
throw new IllegalStateException("no initial parser installed: you must use startWith(...)")
}
@deprecated("Deprecated for internal usage. Will not be emitted any more.", "2.6.20")
class ParsingException(msg: String, cause: Throwable) extends RuntimeException(msg, cause)
val NeedMoreData = new Exception with NoStackTrace