-
Notifications
You must be signed in to change notification settings - Fork 5
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 gRPC status codes #137
base: main
Are you sure you want to change the base?
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.
Looks good to me, leaving for @danicheg to merge.
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.
Thanks for adding this! I mainly agree with the approach, a few (minor) questions/suggestions from me:
codegen/testing/src/test/scala/hello/world/TestServiceSuite.scala
Outdated
Show resolved
Hide resolved
def asStatusRuntimeException(message: Option[String] = None): StatusRuntimeException = | ||
StatusRuntimeException(this, message) |
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.
Is it legit for the Ok status to be considered as StatusRuntimeException?
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.
Yeah, it feels weird. We could further divide codes into success and errors.
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.
Just passing by, but I think we should take gRPC richer error model into consideration for error handling design because there are more and more gRPC implementations that can send extra error details in trailers header(e.g. golang, Java or Rust implementation).
See
- https://grpc.io/docs/guides/error/#richer-error-model
- https://github.com/googleapis/googleapis/blob/e67f6bea8425bbc3a6352ffea8ce2bc6dab45454/google/rpc/status.proto#L35
for more details.
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.
@danicheg How about making the status Ok
package private, since user code should never need it anyways?
An attempt at solving #135.