-
Notifications
You must be signed in to change notification settings - Fork 88
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
Does not set status codes on operation errors #15
Comments
I can get the code into the Exception by tweaking the bit of code @larkee highlighted to use elif self._operation.HasField("error"):
exception = exceptions.from_grpc_status(
status_code=self._operation.error.code,
message=self._operation.error.message,
errors=(self._operation.error,),
response=self._operation,
)
self.set_exception(exception) Even after that change I seemed to always get python-api-core/google/api_core/exceptions.py Lines 188 to 193 in 339b07d
The root cause seems to be that the dict that maps status codes to exception types expects
It wasn't clear to me how to get the enum from an int, so I opened https://groups.google.com/forum/#!topic/grpc-io/EdIXjMEaOyw. |
Fixes #15 🦕 Errors raised by long running operations are currently always type GoogleAPICallError. Use the status code to create a more specific exception type.
Raised in a Cloud Spanner issue, the returned
GoogleAPICallError
has acode
andgrpc_status_code
ofNone
.The issue seems to be at:
https://github.com/googleapis/python-api-core/blob/master/google/api_core/operation.py#L135
The
GoogleAPICallError
constructor does not set the code from theerrors
argument so the error code contained within it is being lost.The text was updated successfully, but these errors were encountered: