File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -911,7 +911,13 @@ async def can_read(self, timeout: float = 0):
911911 """Poll the socket to see if there's data that can be read.""" 
912912 if  not  self .is_connected :
913913 await  self .connect ()
914-  return  await  self ._parser .can_read (timeout )
914+  try :
915+  return  await  self ._parser .can_read (timeout )
916+  except  OSError  as  e :
917+  await  self .disconnect ()
918+  raise  ConnectionError (
919+  f"Error while reading from { self .host }  :{ self .port }  : { e .args }  " 
920+  )
915921
916922 async  def  read_response (self , disable_decoding : bool  =  False ):
917923 """Read the response from a previously sent command""" 
Original file line number Diff line number Diff line change @@ -808,7 +808,13 @@ def can_read(self, timeout=0):
808808 sock  =  self ._sock 
809809 if  not  sock :
810810 self .connect ()
811-  return  self ._parser .can_read (timeout )
811+  try :
812+  return  self ._parser .can_read (timeout )
813+  except  OSError  as  e :
814+  self .disconnect ()
815+  raise  ConnectionError (
816+  f"Error while reading from { self .host }  :{ self .port }  : { e .args }  " 
817+  )
812818
813819 def  read_response (self , disable_decoding = False ):
814820 """Read the response from a previously sent command""" 
                                 You can’t perform that action at this time. 
               
                  
0 commit comments