From 7d4892880e67437fb515771525cd51f28eb4ded8 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Sat, 24 Feb 2007 11:26:59 +0000 Subject: Try to give a meaningful quit message when quitting because of problems --- lib/rbot/ircbot.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/rbot') 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" -- cgit v1.2.3