Correct our general exception handling.
thanks @mperham! see: http://t.co/Jyt7vV4I
This commit is contained in:
parent
67e4f9e159
commit
bd021bbd91
15 changed files with 16 additions and 16 deletions
|
|
@ -14,7 +14,7 @@ module Jobs
|
|||
def self.suppress_annoying_errors(&block)
|
||||
begin
|
||||
yield
|
||||
rescue Exception => e
|
||||
rescue => e
|
||||
Rails.logger.info("error in job: #{e.message}")
|
||||
unless DUMB_ERROR_MESSAGES.include?(e.message)
|
||||
raise e
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ module Jobs
|
|||
begin
|
||||
receiver = Postzord::Receiver::Public.new(xml)
|
||||
receiver.perform!
|
||||
rescue Exception => e
|
||||
rescue => e
|
||||
FEDERATION_LOGGER.info(e.message)
|
||||
raise e
|
||||
end
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class OEmbedCache < ActiveRecord::Base
|
|||
def fetch_and_save_oembed_data!
|
||||
begin
|
||||
response = OEmbed::Providers.get(self.url, {:maxwidth => 420, :maxheight => 420, :frame => 1, :iframe => 1})
|
||||
rescue Exception => e
|
||||
rescue => e
|
||||
# noop
|
||||
else
|
||||
self.data = response.fields
|
||||
|
|
|
|||
|
|
@ -199,7 +199,7 @@ class Person < ActiveRecord::Base
|
|||
url = "#{uri.scheme}://#{uri.host}"
|
||||
url += ":#{uri.port}" unless ["80", "443"].include?(uri.port.to_s)
|
||||
url += "/"
|
||||
rescue Exception => e
|
||||
rescue => e
|
||||
url = @attributes['url']
|
||||
end
|
||||
url
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ class Services::Facebook < Service
|
|||
begin
|
||||
post_params = self.create_post_params(message)
|
||||
Faraday.post("https://graph.facebook.com/me/feed", post_params.to_param)
|
||||
rescue Exception => e
|
||||
rescue => e
|
||||
Rails.logger.info("#{e.message} failed to post to facebook")
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class Services::Tumblr < Service
|
|||
begin
|
||||
resp = access.post('http://tumblr.com/api/write', body)
|
||||
resp
|
||||
rescue Exception
|
||||
rescue => e
|
||||
nil
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ class Services::Twitter < Service
|
|||
|
||||
begin
|
||||
Twitter.update(message)
|
||||
rescue Exception => e
|
||||
rescue => e
|
||||
Rails.logger.info e.message
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class Postzord::Receiver::Private < Postzord::Receiver
|
|||
FEDERATION_LOGGER.info("event=receive status=abort recipient=#{@user.diaspora_handle} sender=#{@salmon.author_id} reason='not_verified for key'")
|
||||
false
|
||||
end
|
||||
rescue Exception => e
|
||||
rescue => e
|
||||
#this sucks
|
||||
FEDERATION_LOGGER.info("Failure to receive #{@object.inspect} for sender:#{@sender.id} for user:#{@user.id}: #{e.message}")
|
||||
raise e
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ class ShareVisibilityConverter
|
|||
u.hidden_shareables[type] ||= []
|
||||
u.hidden_shareables[type] << id unless u.hidden_shareables[type].include?(id)
|
||||
u.save!(:validate => false)
|
||||
rescue Exception =>e
|
||||
rescue => e
|
||||
puts "ERROR: #{e.message} skipping pv with id: #{visibility.id}"
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ namespace :migrations do
|
|||
key.public_link();
|
||||
puts "Uploaded #{current} of #{count}"
|
||||
current += 1
|
||||
rescue Exception => e
|
||||
rescue => e
|
||||
puts "error #{e} on #{current} (#{file_name}), retrying"
|
||||
retry
|
||||
end
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ class Webfinger
|
|||
Rails.logger.info("Getting: #{url} for #{account}")
|
||||
begin
|
||||
Faraday.get(url).body
|
||||
rescue Exception => e
|
||||
rescue => e
|
||||
Rails.logger.info("Failed to fetch: #{url} for #{account}; #{e.message}")
|
||||
raise e
|
||||
end
|
||||
|
|
@ -59,7 +59,7 @@ class Webfinger
|
|||
def host_meta_xrd
|
||||
begin
|
||||
get(host_meta_url)
|
||||
rescue Exception => e
|
||||
rescue => e
|
||||
if self.ssl
|
||||
self.ssl = false
|
||||
retry
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class WebfingerProfile
|
|||
begin
|
||||
pubkey = text_of_attribute( doc.at('Link[rel=diaspora-public-key]'), 'href')
|
||||
@public_key = Base64.decode64 pubkey
|
||||
rescue Exception => e
|
||||
rescue => e
|
||||
Rails.logger.info("event => :invalid_profile, :identifier => #{@account}")
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ describe Webfinger do
|
|||
end
|
||||
|
||||
it 'should retry with ssl off a second time' do
|
||||
finger.should_receive(:get).and_raise
|
||||
finger.should_receive(:get).and_raise(StandardError)
|
||||
finger.should_receive(:get)
|
||||
finger.host_meta_xrd
|
||||
finger.ssl.should be false
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ describe Services::Tumblr do
|
|||
end
|
||||
|
||||
it 'swallows exception raised by tumblr not being webscale' do
|
||||
OAuth::AccessToken.any_instance.should_receive(:post).and_raise
|
||||
OAuth::AccessToken.any_instance.should_receive(:post).and_raise(StandardError)
|
||||
@service.post(@post)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ describe Services::Twitter do
|
|||
end
|
||||
|
||||
it 'swallows exception raised by twitter always being down' do
|
||||
Twitter.should_receive(:update).and_raise
|
||||
Twitter.should_receive(:update).and_raise(StandardError)
|
||||
@service.post(@post)
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue