Permalink
Browse files

added backtrace for unhandled exceptions

  • Loading branch information...
1 parent e20a566 commit d4b3cd766bdc858e328f3100022f4e39a692d095 @arya committed Jul 13, 2009
Showing with 10 additions and 10 deletions.
  1. +1 −1 lib/pandemic/server_side/client.rb
  2. +6 −6 lib/pandemic/server_side/peer.rb
  3. +3 −3 lib/pandemic/server_side/server.rb
@@ -62,7 +62,7 @@ def listen
info("Connection to client lost")
close_connection
rescue Exception => e
- warn("Unhandled exception in client listen thread: #{e.inspect}")
+ warn("Unhandled exception in client listen thread:\n#{e.inspect}\n#{e.backtrace.join("\n")}")
ensure
@current_request.cancel! if @current_request
@server.client_closed(self)
@@ -69,7 +69,7 @@ def add_incoming_connection(conn)
end
end
rescue Exception => e
- warn("Unhandled exception in peer listener thread: #{e.inspect}")
+ warn("Unhandled exception in peer listener thread:\n#{e.inspect}\n#{e.backtrace.join("\n")}")
ensure
debug("Incoming connection closing")
conn.close if conn && !conn.closed?
@@ -103,7 +103,7 @@ def initialize_connection_pool
retry
end
rescue Exception => e
- warn("Unhandled exception in create connection block: #{e.inspect}")
+ warn("Unhandled exception in create connection block:\n#{e.inspect}\n#{e.backtrace.join("\n")}")
end
if connection
connection.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1) if TCP_NO_DELAY_AVAILABLE
@@ -128,7 +128,7 @@ def handle_incoming_request(request, connection)
# TODO: what to do here?
return false
rescue Exception => e
- warn("Unhandled exception in incoming request read: #{e.inspect}")
+ warn("Unhandled exception in incoming request read:\n#{e.inspect}\n#{e.backtrace.join("\n")}")
end
debug("Processing body")
process_request(hash, request_body)
@@ -153,7 +153,7 @@ def handle_incoming_response(response, connection)
# TODO: what to do here?
return false
rescue Exception => e
- warn("Unhandled exception in incoming response read: #{e.inspect}")
+ warn("Unhandled exception in incoming response read:\n#{e.inspect}\n#{e.backtrace.join("\n")}")
end
process_response(hash, response_body)
else
@@ -177,7 +177,7 @@ def process_request(hash, body)
debug( "Finished sending response (#{hash})")
end
rescue Exception => e
- warn("Unhandled exception in process request thread: #{e.inspect}")
+ warn("Unhandled exception in process request thread:\n#{e.inspect}\n#{e.backtrace.join("\n")}")
end
end
end
@@ -194,7 +194,7 @@ def process_response(hash, body)
warn("Original response not found (#{hash})")
end
rescue Exception => e
- warn("Unhandled exception in process response thread: #{e.inspect}")
+ warn("Unhandled exception in process response thread:\n#{e.inspect}\n#{e.backtrace.join("\n")}")
end
end
end
@@ -75,7 +75,7 @@ def start
@peers.values.each { |p| p.disconnect }
@clients.each {|c| c.close }
rescue Exception => e
- warn("Unhandled exception in server listening thread: #{e.inspect}")
+ warn("Unhandled exception in server listening thread:\n#{e.inspect}\n#{e.backtrace.join("\n")}")
end
end
end
@@ -110,7 +110,7 @@ def handle_connection(connection)
connection.close # i dunno you
end
rescue Exception => e
- warn("Unhandled exception in handle connection method: #{e.inspect}")
+ warn("Unhandled exception in handle connection method:\n#{e.inspect}\n#{e.backtrace.join("\n")}")
end
end
@@ -132,7 +132,7 @@ def handle_client_request(request)
begin
request.add_response(self.process(map[signature]))
rescue Exception => e
- warn("Unhandled exception in local processing: #{e.inspect}#{e.backtrace.join("\n")}}")
+ warn("Unhandled exception in local processing:\n#{e.inspect}#{e.backtrace.join("\n")}}")
end
end
end

0 comments on commit d4b3cd7

Please sign in to comment.