File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -805,16 +805,19 @@ def can_read(self, timeout=0):
805
805
806
806
def read_response (self , disable_decoding = False ):
807
807
"""Read the response from a previously sent command"""
808
+ try :
809
+ hosterr = f"{ self .host } :{ self .port } "
810
+ except AttributeError :
811
+ hosterr = "connection"
812
+
808
813
try :
809
814
response = self ._parser .read_response (disable_decoding = disable_decoding )
810
815
except socket .timeout :
811
816
self .disconnect ()
812
- raise TimeoutError (f"Timeout reading from { self . host } : { self . port } " )
817
+ raise TimeoutError (f"Timeout reading from { hosterr } " )
813
818
except OSError as e :
814
819
self .disconnect ()
815
- raise ConnectionError (
816
- f"Error while reading from { self .host } :{ self .port } " f" : { e .args } "
817
- )
820
+ raise ConnectionError (f"Error while reading from { hosterr } " f" : { e .args } " )
818
821
except BaseException :
819
822
self .disconnect ()
820
823
raise
You can’t perform that action at this time.
0 commit comments