pjfanning commented on code in PR #1635:
URL: https://github.com/apache/pekko/pull/1635#discussion_r1898915322


##########
multi-node-testkit/src/main/scala/org/apache/pekko/remote/testconductor/RemoteConnection.scala:
##########
@@ -56,8 +56,15 @@ private[pekko] class ProtobufEncoder extends 
MessageToMessageEncoder[Message] {
 private[pekko] class ProtobufDecoder(prototype: Message) extends 
MessageToMessageDecoder[ByteBuf] {
 
   override def decode(ctx: ChannelHandlerContext, msg: ByteBuf, out: 
java.util.List[AnyRef]): Unit = {
-    val bytes = ByteBufUtil.getBytes(msg)
-    out.add(prototype.getParserForType.parseFrom(bytes))
+    try {
+      val bytes = ByteBufUtil.getBytes(msg)
+      out.add(prototype.getParserForType.parseFrom(bytes))
+    } catch {
+      case NonFatal(e) =>
+        throw new RuntimeException("Error while decoding protobuf message", e)

Review Comment:
   why not rethrow the e? I dislike using the super generic RuntimeException 
here. If we need to wrap the exception, can't we find something more specific 
or create a new class like NettyDecodeException.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@pekko.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@pekko.apache.org
For additional commands, e-mail: notifications-h...@pekko.apache.org

Reply via email to