From e734bd816008e1380d8400610e34c38a2cfbe327 Mon Sep 17 00:00:00 2001 From: Ondra Pelech Date: Tue, 25 Aug 2020 13:54:53 +0200 Subject: [PATCH] catch ParseException as a know, JSON parsing related exception (#104) --- .../avast/grpc/jsonbridge/scalapb/ScalaPBServiceHandlers.scala | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core-scalapb/src/main/scala/com/avast/grpc/jsonbridge/scalapb/ScalaPBServiceHandlers.scala b/core-scalapb/src/main/scala/com/avast/grpc/jsonbridge/scalapb/ScalaPBServiceHandlers.scala index 94314d84..a1c9bc05 100644 --- a/core-scalapb/src/main/scala/com/avast/grpc/jsonbridge/scalapb/ScalaPBServiceHandlers.scala +++ b/core-scalapb/src/main/scala/com/avast/grpc/jsonbridge/scalapb/ScalaPBServiceHandlers.scala @@ -12,6 +12,7 @@ import com.typesafe.scalalogging.StrictLogging import io.grpc._ import io.grpc.protobuf.ProtoFileDescriptorSupplier import io.grpc.stub.AbstractStub +import org.json4s.ParserUtil.ParseException import scalapb.json4s.JsonFormatException import scalapb.{GeneratedMessage, GeneratedMessageCompanion} @@ -95,6 +96,7 @@ private[jsonbridge] object ScalaPBServiceHandlers extends ServiceHandlers with S parse(input, requestCompanion) match { case Left(e: JsonProcessingException) => F.pure(Left(BridgeError.Json(e))) case Left(e: JsonFormatException) => F.pure(Left(BridgeError.Json(e))) + case Left(e: ParseException) => F.pure(Left(BridgeError.Json(e))) case Left(e) => F.pure(Left(BridgeError.Unknown(e))) case Right(request) => fromScalaFuture(ec) {