remove the swallowing of generic messages from facebook and twitter postiing. I want to know why sometimes these things are failing

This commit is contained in:
Maxwell Salzberg 2012-03-19 19:17:46 -07:00
parent 3c83f671ac
commit 3cb7003361
4 changed files with 5 additions and 11 deletions

View file

@ -8,12 +8,8 @@ class Services::Facebook < Service
def post(post, url='')
Rails.logger.debug("event=post_to_service type=facebook sender_id=#{self.user_id}")
message = public_message(post, url)
begin
post_params = self.create_post_params(message)
Faraday.post("https://graph.facebook.com/me/feed", post_params.to_param)
rescue => e
Rails.logger.info("#{e.message} failed to post to facebook")
end
post_params = self.create_post_params(message)
Faraday.post("https://graph.facebook.com/me/feed", post_params.to_param)
end
def create_post_params(message)

View file

@ -14,11 +14,7 @@ class Services::Twitter < Service
configure_twitter
begin
Twitter.update(message)
rescue => e
Rails.logger.info e.message
end
Twitter.update(message)
end

View file

@ -16,6 +16,7 @@ describe Services::Facebook do
end
it 'swallows exception raised by facebook always being down' do
pending
stub_request(:post,"https://graph.facebook.com/me/feed").
to_raise(StandardError)
@service.post(@post)

View file

@ -16,6 +16,7 @@ describe Services::Twitter do
end
it 'swallows exception raised by twitter always being down' do
pending
Twitter.should_receive(:update).and_raise(StandardError)
@service.post(@post)
end