-
Notifications
You must be signed in to change notification settings - Fork 95
Closed
Labels
priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Description
In exceptions.py, if grpcio-status is not installed, rpc_status is set to None
python-api-core/google/api_core/exceptions.py
Lines 31 to 43 in d96eb5c
| try: | |
| import grpc | |
| try: | |
| from grpc_status import rpc_status | |
| except ImportError: # pragma: NO COVER | |
| warnings.warn( | |
| "Please install grpcio-status to obtain helpful grpc error messages.", | |
| ImportWarning, | |
| ) | |
| rpc_status = None | |
| except ImportError: # pragma: NO COVER | |
| grpc = None |
In _parse_grpc_error_details, when rpc_status is None, this leads to AttributeError: 'NoneType' object has no attribute 'from_call'
python-api-core/google/api_core/exceptions.py
Lines 562 to 566 in d96eb5c
| def _parse_grpc_error_details(rpc_exc): | |
| try: | |
| status = rpc_status.from_call(rpc_exc) | |
| except NotImplementedError: # workaround | |
| return [], None |
We should add a check to make sure rpc_status is not None before calling rpc_status.from_call(rpc_exc)
Metadata
Metadata
Assignees
Labels
priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.