Skip to content
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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

moleike
Copy link

@moleike moleike commented Oct 16, 2024

An attempt at solving #135.

Copy link
Contributor

@hamnis hamnis left a 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.

Copy link
Member

@danicheg danicheg left a 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:

Comment on lines +8 to +9
def asStatusRuntimeException(message: Option[String] = None): StatusRuntimeException =
StatusRuntimeException(this, message)
Copy link
Member

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?

Copy link
Author

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.

Copy link
Contributor

@i10416 i10416 Nov 1, 2024

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

for more details.

Copy link
Author

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?

core/src/main/scala/org/http4s/grpc/ServerGrpc.scala Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants