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):
805805
806806 def read_response (self , disable_decoding = False ):
807807 """Read the response from a previously sent command"""
808+ try :
809+ hosterr = f"{ self .host } :{ self .port } "
810+ except AttributeError :
811+ hosterr = "connection"
812+
808813 try :
809814 response = self ._parser .read_response (disable_decoding = disable_decoding )
810815 except socket .timeout :
811816 self .disconnect ()
812- raise TimeoutError (f"Timeout reading from { self . host } : { self . port } " )
817+ raise TimeoutError (f"Timeout reading from { hosterr } " )
813818 except OSError as e :
814819 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 } " )
818821 except BaseException :
819822 self .disconnect ()
820823 raise
You can’t perform that action at this time.
0 commit comments