At work we're standardizing on using the Richer Error Model
<https://www.grpc.io/docs/guides/error/#richer-error-model> and had success
using it in Go with the errdetails
<https://godoc.org/google.golang.org/genproto/googleapis/rpc/errdetails>
package and WithDetails
<https://godoc.org/google.golang.org/grpc/status#Status.WithDetails> method.
However, we also write a lot of Ruby. In Ruby, it's not documented how you
would attach details
<https://cloud.google.com/apis/design/errors#error_model> to the status. Is
it possible to attach error details using the error classes
<https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/errors.rb#L30>
e.g. GRPC::InvalidArgument? If not, is it possible to write my own error
classes which would allow attaching details?
For example perhaps I can create an API like this?
raise GRPC::InvalidArgument.new(
"foo.bar must only contain alphanumeric characters",
details: Google::Rpc::BadRequest.new(
field_violations: [
Google::Rpc::BadRequest::FieldViolation.new(
field: "foo.bar",
description: "must only contain alphanumeric characters"
)
]
)
)
--
You received this message because you are subscribed to the Google Groups
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/grpc-io/8c4653e9-9d8f-4058-b9d8-5b514b7cab72%40googlegroups.com.