summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2011-06-11 16:26:09 +0200
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2011-06-11 16:26:09 +0200
commit2a3bc07d139593f1f57e23cfbd08602d29a8b26c (patch)
tree5120a20bd222d12d15b960862b853a196add997a /lib
parent1fbb090ea91ab20916b3698d8afd6e300673b826 (diff)
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.
Diffstat (limited to 'lib')
-rw-r--r--lib/rbot/ircbot.rb7
-rw-r--r--lib/rbot/ircsocket.rb1
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 || '<unknown>'
+ 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