Skip to content

Commit 883e14c

Browse files
committed
Check if response has exception before trying to access result
1 parent e1d3c3b commit 883e14c

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

contrib/opencensus-ext-grpc/opencensus/ext/grpc/client_interceptor.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,12 @@ def _intercept_call(
127127

128128
def _callback(self, current_span):
129129
def callback(future_response):
130-
grpc_utils.add_message_event(
131-
proto_message=future_response.result(),
132-
span=current_span,
133-
message_event_type=time_event.Type.RECEIVED,
134-
)
130+
if not future_response.exception():
131+
grpc_utils.add_message_event(
132+
proto_message=future_response.result(),
133+
span=current_span,
134+
message_event_type=time_event.Type.RECEIVED,
135+
)
135136
self._trace_future_exception(future_response)
136137
self.tracer.end_span()
137138

0 commit comments

Comments
 (0)