File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -677,12 +677,19 @@ def _error_message(self, exception):
677677 # args for socket.error can either be (errno, "message")
678678 # or just "message"
679679 if len (exception .args ) == 1 :
680- return f"Error connecting to { self .host } :{ self .port } . { exception .args [0 ]} ."
680+ try :
681+ return f"Error connecting to { self .host } :{ self .port } . \
682+ { exception .args [0 ]} ."
683+ except AttributeError :
684+ return f"Connection Error: { exception .args [0 ]} "
681685 else :
682- return (
683- f"Error { exception .args [0 ]} connecting to "
684- f"{ self .host } :{ self .port } . { exception .args [1 ]} ."
685- )
686+ try :
687+ return (
688+ f"Error { exception .args [0 ]} connecting to "
689+ f"{ self .host } :{ self .port } . { exception .args [1 ]} ."
690+ )
691+ except AttributeError :
692+ return f"Connection Error: { exception .args [0 ]} "
686693
687694 def on_connect (self ):
688695 "Initialize the connection, authenticate and select a database"
You can’t perform that action at this time.
0 commit comments