Skip to content

Commit

Permalink
catch ParseException as a know, JSON parsing related exception (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
sideeffffect authored Aug 25, 2020
1 parent c44ff7e commit e734bd8
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit e734bd8

Please sign in to comment.