Skip to content

Commit 5f3e5ba

Browse files
committed
throw better error msg when stream is not opened
1 parent 4ee9826 commit 5f3e5ba

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

google/api_core/bidi.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ def send(self, request):
303303
request (protobuf.Message): The request to send.
304304
"""
305305
if self.call is None:
306-
raise ValueError("Cannot send on an RPC that has never been opened.")
306+
raise ValueError("Cannot send on an RPC stream that has never been opened.")
307307

308308
# Don't use self.is_active(), as ResumableBidiRpc will overload it
309309
# to mean something semantically different.
@@ -324,7 +324,7 @@ def recv(self):
324324
protobuf.Message: The received message.
325325
"""
326326
if self.call is None:
327-
raise ValueError("Cannot recv on an RPC that has never been opened.")
327+
raise ValueError("Cannot recv on an RPC stream that has never been opened.")
328328

329329
return next(self.call)
330330

google/api_core/bidi_async.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
_LOGGER = logging.getLogger(__name__)
3030

3131

32-
3332
class _AsyncRequestQueueGenerator:
3433
"""_AsyncRequestQueueGenerator is a helper class for sending asynchronous
3534
requests to a gRPC stream from a Queue.
@@ -218,7 +217,7 @@ async def send(self, request: ProtobufMessage) -> None:
218217
request (ProtobufMessage): The request to send.
219218
"""
220219
if self.call is None:
221-
raise ValueError("Cannot send on an RPC that has never been opened.")
220+
raise ValueError("Cannot send on an RPC stream that has never been opened.")
222221

223222
if not self.call.done():
224223
await self._request_queue.put(request)
@@ -235,7 +234,7 @@ async def recv(self) -> ProtobufMessage:
235234
ProtobufMessage: The received message.
236235
"""
237236
if self.call is None:
238-
raise ValueError("Cannot recv on an RPC that has never been opened.")
237+
raise ValueError("Cannot recv on an RPC stream that has never been opened.")
239238

240239
return await self.call.read()
241240

0 commit comments

Comments
 (0)