summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-02-24 11:26:59 +0000
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-02-24 11:26:59 +0000
commit7d4892880e67437fb515771525cd51f28eb4ded8 (patch)
tree602e3a16bb61f9828b23b805d503ade24208fa18
parent3e6358720b5a8d256a082139e38230c1f815740f (diff)
Try to give a meaningful quit message when quitting because of problems
-rw-r--r--lib/rbot/ircbot.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/rbot/ircbot.rb b/lib/rbot/ircbot.rb
index 57dd8927..491fa517 100644
--- a/lib/rbot/ircbot.rb
+++ b/lib/rbot/ircbot.rb
@@ -712,6 +712,7 @@ class Bot
connect
@timer.start
+ quit_msg = nil
while @socket.connected?
quit if $interrupted > 0
@@ -737,6 +738,7 @@ class Bot
rescue Errno::ETIMEDOUT, Errno::ECONNABORTED, TimeoutError, SocketError => e
error "network exception: #{e.class}: #{e}"
debug e.backtrace.join("\n")
+ quit_msg = e.to_s
rescue BDB::Fatal => e
fatal "fatal bdb error: #{e.class}: #{e}"
fatal e.backtrace.join("\n")
@@ -748,6 +750,7 @@ class Bot
rescue Exception => e
error "non-net exception: #{e.class}: #{e}"
error e.backtrace.join("\n")
+ quit_msg = e.to_s
rescue => e
fatal "unexpected exception: #{e.class}: #{e}"
fatal e.backtrace.join("\n")
@@ -755,7 +758,7 @@ class Bot
exit 2
end
- disconnect
+ disconnect(quit_msg)
log "\n\nDisconnected\n\n"