Permalink
Browse files

Catch timeout errors and raise notification error

  • Loading branch information...
1 parent cc2a9ae commit 2ec84a2c90ce31db42adcb03a818caea41444c7c Jesse Stuart committed Dec 12, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/tentd/model/notification_subscription.rb
@@ -104,7 +104,7 @@ def self.notify_entity(entity, post_id, view='full')
res = client.post.create(post.as_json(:view => view), :url => path)
raise NotificationError.new("[#{res.to_hash[:url].to_s}] #{res.status}: #{res.body}") unless (200...300).include?(res.status)
res
- rescue Faraday::Error::ConnectionFailed, Errno::ETIMEDOUT => e
+ rescue Faraday::Error::ConnectionFailed, Faraday::Error::TimeoutError, Errno::ETIMEDOUT => e
url = res ? res.to_hash[:url].to_s : ""
raise NotificationError.new(:message => "[#{url}] #{e.message}", :backtrace => e.backtrace)
end
@@ -117,7 +117,7 @@ def notify_about(post_id, view='full')
res = client.post.create(post.as_json(:app => !!app_authorization, :permissions => permissions, :view => view), :url => subject.notification_path)
raise NotificationError.new("[#{res.to_hash[:url].to_s}] #{res.status}: #{res.body}") unless (200...300).include?(res.status)
res
- rescue Faraday::Error::ConnectionFailed, Errno::ETIMEDOUT => e
+ rescue Faraday::Error::ConnectionFailed, Faraday::Error::TimeoutError, Errno::ETIMEDOUT => e
url = res ? res.to_hash[:url].to_s : ""
raise NotificationError.new(:message => "[#{url}] #{e.message}", :backtrace => e.backtrace)
end

0 comments on commit 2ec84a2

Please sign in to comment.