At work we're standardizing on using the
Richer Error Model and had success using it in Go with the
errdetails package and
WithDetails method. However, we also write a lot of Ruby. In Ruby, it's not documented how you would attach
details to the status. Is it possible to attach error details using the
error classes 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"
)
]
)
)