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

example of how to return errors #402

Open
pelicanlion opened this issue Aug 23, 2023 · 2 comments
Open

example of how to return errors #402

pelicanlion opened this issue Aug 23, 2023 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@pelicanlion
Copy link

Are there examples of how to return error responses using Kotlin styled builders?

For example, something like this:

Status.newBuilder()
  .setCode(Code.INTERNAL_VALUE)
  .addDetails(Any.pack(details))
  .build()

but with this style of syntax

status {
  code = Code.INTERNAL_VALUE
  details = any {
     pack(details)
  }
}

If this is possible how does one import these builders?

@jamesward
Copy link
Collaborator

Seems like something grpc-kotlin could provide a nice wrapper around but I don't think it currently does.

@jamesward jamesward added the enhancement New feature or request label Aug 23, 2023
@lowasser
Copy link
Collaborator

@jamesward is correct; we do not currently provide any API like this. I think there also may be confusion between io.grpc.Status and com.google.rpc.Status, the latter of which would just use Kotlin protobufs, which is a separate project from gRPC-Kotlin. It's not clear to me that com.google.rpc.Status actually has any specific relationship with gRPC other than being used in some RPC services. io.grpc.Status is, as far as I'm aware, the only type with specific API and handling from the gRPC API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants