Skip to content

Commit

Permalink
Rescue all StandardErrors, not Exceptions.
Browse files Browse the repository at this point in the history
  • Loading branch information
dgraham committed Mar 18, 2012
1 parent 92e582b commit 012a3ba
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/vines/cluster.rb
Expand Up @@ -192,7 +192,7 @@ def pubsub_subscribers(domain, node)
def heartbeat
@publisher.broadcast(:heartbeat)
@sessions.expire
rescue Exception => e
rescue => e
log.error("Cluster session cleanup failed: #{e}")
end

Expand Down
2 changes: 1 addition & 1 deletion lib/vines/cluster/subscriber.rb
Expand Up @@ -52,7 +52,7 @@ def on_message(channel, message)
when ALL then to_all(doc)
when @channel then to_node(doc)
end
rescue Exception => e
rescue => e
log.error("Cluster subscription message failed: #{e}")
end

Expand Down
2 changes: 1 addition & 1 deletion lib/vines/command/ldap.rb
Expand Up @@ -24,7 +24,7 @@ def run(opts)

begin
user = storage.ldap.authenticate(jid, password)
rescue Exception => e
rescue => e
raise "LDAP connection failed: #{e.message}"
end

Expand Down
2 changes: 1 addition & 1 deletion lib/vines/command/schema.rb
Expand Up @@ -15,7 +15,7 @@ def run(opts)
end
begin
storage.create_schema
rescue Exception => e
rescue => e
raise "Schema creation failed: #{e.message}"
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/vines/storage.rb
Expand Up @@ -42,7 +42,7 @@ def self.defer(method)
op = proc do
begin
method(old).call(*args)
rescue Exception => e
rescue => e
log.error("Thread pool operation failed: #{e.message}")
nil
end
Expand Down Expand Up @@ -218,7 +218,7 @@ def authenticate_with_ldap(username, password, &block)
op = proc do
begin
ldap.authenticate(username, password)
rescue Exception => e
rescue => e
log.error("LDAP authentication failed: #{e.message}")
nil
end
Expand Down
2 changes: 1 addition & 1 deletion lib/vines/stream.rb
Expand Up @@ -210,7 +210,7 @@ def process_node(node)
else
state.node(node)
end
rescue Exception => e
rescue => e
error(e)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/vines/stream/client/auth.rb
Expand Up @@ -58,7 +58,7 @@ def plain_auth(stanza)
begin
user = stream.storage.authenticate(jid, password)
finish(user || SaslErrors::NotAuthorized.new)
rescue Exception => e
rescue => e
log.error("Failed to authenticate: #{e.to_s}")
finish(SaslErrors::TemporaryAuthFailure.new)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/vines/stream/http/sessions.rb
Expand Up @@ -56,7 +56,7 @@ def cleanup
@sessions.each_value do |session|
session.close if session.expired?
end
rescue Exception => e
rescue => e
log.error("Expired session cleanup failed: #{e}")
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/vines/stream/server.rb
Expand Up @@ -42,7 +42,7 @@ def self.connect(config, to, from, srv, callback)
rr = srv.shift
opts = {to: to, from: from, srv: srv, callback: callback}
EM.connect(rr.target.to_s, rr.port, Server, config, opts)
rescue Exception => e
rescue => e
connect(config, to, from, srv, callback)
end
end
Expand Down

0 comments on commit 012a3ba

Please sign in to comment.