diregapic: errors that appear in the Operation type should be returned by Poll #1320
Labels
priority: p2
Moderately-important priority. Fix may not be included in next release.
type: bug
Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
googleapis/google-cloud-go#7876 points out that when an Operation actually resulted in an error, the client isn't surfacing that to the users as an
error
. It should do this.The tricky part is that the
Error
type is bespoke, and doesn't align with either error type traditional APIs returnedgoogleapi.Error
andgoogle.rpc.Status
.So the
Operation
type incompute.proto
has its code and message fields annotated withERROR_CODE
andERROR_MESSAGE
google.cloud.operation_field
annotations, which we can use to create an error. I've copied them below to save loading a large proto file:We can create a
googleapi.Error
/apierror.APIError
from that information, but those will be very very limited without theError error
field info.To help with this, we may also want to consider adding some manual code to extend the generated operation handles that will extract the extra error details from
Error error
.error
based on if theERROR_CODE
and/orERROR_MESSAGE
fields are populated with non-default values (0
and""
respectively)Error error
information. This is likely required to be manually added.The text was updated successfully, but these errors were encountered: