Skip to content

Commit

Permalink
fix: allow grpc without grpcio-status (#355)
Browse files Browse the repository at this point in the history
  • Loading branch information
parthea authored Mar 15, 2022
1 parent c89f55d commit 112049e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions google/api_core/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,23 @@
import http.client
from typing import Dict
from typing import Union
import warnings

from google.rpc import error_details_pb2

try:
import grpc
from grpc_status import rpc_status

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
rpc_status = None

# Lookup tables for mapping exceptions from HTTP and gRPC transports.
# Populated by _GoogleAPICallErrorMeta
Expand Down

0 comments on commit 112049e

Please sign in to comment.