aboutsummaryrefslogtreecommitdiffstats
path: root/lib/quiet_opener.rb
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2015-03-30 16:00:02 +0100
committerLouise Crow <louise.crow@gmail.com>2015-03-30 16:00:02 +0100
commitf24cc98afa25ad6010ae5316eecc15dfdb3fa79b (patch)
treec32fecb16bb2097da7dfdf90e6915fce0bf1a425 /lib/quiet_opener.rb
parent823e58dc69960c600230b10604a0051359173f85 (diff)
parent3c0604cf900ad274d8f6ff421d39854ccbf4b6af (diff)
Merge branch 'release/0.21'0.21.0.0
Conflicts: locale/cy/app.po locale/es_NI/app.po locale/hr/app.po locale/is_IS/app.po locale/sr@latin/app.po
Diffstat (limited to 'lib/quiet_opener.rb')
-rw-r--r--lib/quiet_opener.rb15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/quiet_opener.rb b/lib/quiet_opener.rb
index 16ea27b8e..c6e259b93 100644
--- a/lib/quiet_opener.rb
+++ b/lib/quiet_opener.rb
@@ -7,8 +7,19 @@ end
def quietly_try_to_open(url)
begin
result = open(url).read.strip
- rescue OpenURI::HTTPError, SocketError, Errno::ETIMEDOUT, Errno::ECONNREFUSED, Errno::EHOSTUNREACH, Errno::ECONNRESET
- Rails.logger.warn("Unable to open third-party URL #{url}")
+ rescue OpenURI::HTTPError,
+ SocketError,
+ Errno::ETIMEDOUT,
+ Errno::ECONNREFUSED,
+ Errno::EHOSTUNREACH,
+ Errno::ECONNRESET,
+ Timeout::Error => exception
+ e = Exception.new("Unable to open third-party URL #{url}: #{exception.message}")
+ e.set_backtrace(exception.backtrace)
+ if !AlaveteliConfiguration.exception_notifications_from.blank? && !AlaveteliConfiguration.exception_notifications_to.blank?
+ ExceptionNotifier::Notifier.exception_notification(request.env, e).deliver
+ end
+ Rails.logger.warn(e.message)
result = ""
end
return result