Closed alexklibisz closed 6 months ago
I added the create
method in https://github.com/akka/akka-grpc/pull/1933/commits/ed7a91359de5b3a28db1a639834ac5e0abf1699e
And added an example to the LoggingErrorHandlingGreeterServer in https://github.com/akka/akka-grpc/pull/1933/commits/18856521d354a8e9030b9d2d26485bd95fb44340.
If that example looks good, I can do the same on the Java side.
That example looks good, please add for Java as well 👍
Ran into an issue in the Java example. Commented inline.
I'm seeing an error in the Gradle build: https://github.com/akka/akka-grpc/actions/runs/8851059859/job/24306757026?pr=1933#step:9:131
Error: /home/runner/work/akka-grpc/akka-grpc/plugin-tester-scala/src/main/scala/example/myapp/helloworld/LoggingErrorHandlingGreeterServer.scala:89: class com.google.rpc.LocalizedMessage is not a value
on the line:
Trailers(com.google.rpc.Code.INVALID_ARGUMENT, ex.getMessage, List(LocalizedMessage("en-US", ex.getMessage)))
I guess it's possible that gradle isn't configured to know about the scalapb-generated LocalizedMessage. 🤔
@johanandren This is ready for another look. I might need a hint on how to get the Gradle Scala build working.
The plugin-tester-scala is used for verifying building Scala projects with gradle and maven in addition to the "normal" sbt, so those two project files needed some ammends, I've pushed fixes that should sort it.
The handler generated by akka-grpc takes an error handler in the form of
eHandler: ActorSystem => PartialFunction[Throwable, Trailers]
.This change just adds a method to make it easier to construct an instance of Trailers containing rich error details, so that we can enrich the error response from within the error handler.
Couple things I'm not sure about in the initial implementation:
GrpcServiceException.apply
method. Is there a preferred way to would abstract out the common code? I.e., create a Utils object somewhere.