Skip to content
This repository has been archived by the owner on Apr 15, 2020. It is now read-only.

Commit

Permalink
added backtrace for unhandled exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
arya committed Jul 13, 2009
1 parent e20a566 commit d4b3cd7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/pandemic/server_side/client.rb
Expand Up @@ -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)
Expand Down
12 changes: 6 additions & 6 deletions lib/pandemic/server_side/peer.rb
Expand Up @@ -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?
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions lib/pandemic/server_side/server.rb
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -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
Expand Down

0 comments on commit d4b3cd7

Please sign in to comment.