grpc-kotlin
grpc-kotlin copied to clipboard
example of how to return errors
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?
Seems like something grpc-kotlin could provide a nice wrapper around but I don't think it currently does.
@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.