lib/breakers/uptime_middleware.rb in breakers-0.2.2 vs lib/breakers/uptime_middleware.rb in breakers-0.2.3
- old
+ new
@@ -67,11 +67,20 @@
Breakers.client.plugins.each do |plugin|
plugin.on_success(service, request_env, response_env) if plugin.respond_to?(:on_success)
end
end
end
+ rescue Faraday::Error::TimeoutError => e
+ handle_error(
+ service: service,
+ request_env: request_env,
+ response_env: nil,
+ error: "#{e.class.name} - #{e.message}",
+ current_outage: current_outage
+ )
+ raise
rescue => e
- unless e.is_a?(Breakers::OutageException)
+ if service.exception_represents_server_error?(e)
handle_error(
service: service,
request_env: request_env,
response_env: nil,
error: "#{e.class.name} - #{e.message}",