-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Trailers.apply to construct from code, message, and details #1933
Add Trailers.apply to construct from code, message, and details #1933
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A lot of the test coverage is in the akka-grpc-plugin-tester-{java,scala}
modules which have more access to actual message generation etc. so maybe sneak in some coverage there in LoggingErrorHandlingGreeterServer.java
and LoggingErrorHandlingGreeterServer.scala
. Those also has snippets that goes in the docs which may be useful to show off the new signature. For example the custom-error-mapping
snippet.
Looks like there is no actual test calling those, but since this mostly adds convenience and no real logic having it used in something that is compiled as a part of the test suite is probably enough.
That example looks good, please add for Java as well 👍 |
...in-tester-java/src/main/java/example/myapp/helloworld/LoggingErrorHandlingGreeterServer.java
Show resolved
Hide resolved
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
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks! Tricker than you'd think at first.
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.