From 2a3bc07d139593f1f57e23cfbd08602d29a8b26c Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Sat, 11 Jun 2011 16:26:09 +0200 Subject: Saner treatment for connect errors Rather than raising changing the message (a message that would not be displayed anyway), display the (composed) error message and then reraise without further changes. --- lib/rbot/ircbot.rb | 7 +++++-- lib/rbot/ircsocket.rb | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/rbot/ircbot.rb b/lib/rbot/ircbot.rb index a48251c2..bd75bec5 100644 --- a/lib/rbot/ircbot.rb +++ b/lib/rbot/ircbot.rb @@ -940,8 +940,11 @@ class Bot quit if $interrupted > 0 @socket.connect @last_rec = Time.now - rescue => e - raise e.class, "failed to connect to IRC server at #{@socket.server_uri}: #{e}" + rescue Exception => e + uri = @socket.server_uri || '' + error "failed to connect to IRC server at #{uri}" + error e + raise end quit if $interrupted > 0 diff --git a/lib/rbot/ircsocket.rb b/lib/rbot/ircsocket.rb index 652b1f6d..4c11094b 100644 --- a/lib/rbot/ircsocket.rb +++ b/lib/rbot/ircsocket.rb @@ -401,6 +401,7 @@ module Irc error "error while shutting down: #{e.pretty_inspect}" end @sock = nil + @server_uri = nil @sendq.clear end -- cgit v1.2.3