summaryrefslogtreecommitdiff
path: root/lib/rbot/ircsocket.rb
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-04-11 17:32:26 +0000
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-04-11 17:32:26 +0000
commita9b32eae21a10254f67653c8ce92076300ba670b (patch)
treed57eb4880b67c79ab7d03a148a9712e12914926d /lib/rbot/ircsocket.rb
parent51cd66a19fe4b1a3a3cd1dedd5b1f37ab08ccdc8 (diff)
use pretty printing with Logger (debug, info, warning and error messages)
Diffstat (limited to 'lib/rbot/ircsocket.rb')
-rw-r--r--lib/rbot/ircsocket.rb21
1 files changed, 9 insertions, 12 deletions
diff --git a/lib/rbot/ircsocket.rb b/lib/rbot/ircsocket.rb
index b825a768..dcc501a3 100644
--- a/lib/rbot/ircsocket.rb
+++ b/lib/rbot/ircsocket.rb
@@ -395,13 +395,12 @@ module Irc
end
end
- def handle_socket_error(string, err)
- error "#{string} failed: #{err.inspect}"
- debug err.backtrace.join("\n")
+ def handle_socket_error(string, e)
+ error "#{string} failed: #{e.pretty_inspect}"
# We assume that an error means that there are connection
# problems and that we should reconnect, so we
shutdown
- raise SocketError.new(err.inspect)
+ raise SocketError.new(e.inspect)
end
# get the next line from the server (blocks)
@@ -416,7 +415,7 @@ module Irc
reply.strip! if reply
debug "RECV: #{reply.inspect}"
return reply
- rescue => e
+ rescue Exception => e
handle_socket_error(:RECV, e)
end
end
@@ -461,9 +460,8 @@ module Irc
if @sendq.empty?
@timer.stop
end
- rescue => e
- error "Spooling failed: #{e.inspect}"
- error e.backtrace.join("\n")
+ rescue Exception => e
+ error "Spooling failed: #{e.pretty_inspect}"
end
end
end
@@ -495,9 +493,8 @@ module Irc
return unless connected?
begin
@sock.close
- rescue => err
- error "error while shutting down: #{err.inspect}"
- debug err.backtrace.join("\n")
+ rescue Exception => e
+ error "error while shutting down: #{e.pretty_inspect}"
end
@rawsock = nil if @ssl
@sock = nil
@@ -520,7 +517,7 @@ module Irc
@lines_sent += 1
@burst += 1
end
- rescue => e
+ rescue Exception => e
handle_socket_error(:SEND, e)
end
end