with_error_handling

in lib/winagent.rb [87:111]


  def with_error_handling
    yield
  rescue SocketError => e
    log(:info, "#{description}: failed to run as the connection failed! #{e.class} - #{e.message} - #{e.backtrace.join("\n")}")
    sleep InstanceAgent::Config.config[:wait_after_connection_problem]
  rescue Exception => e
    if (e.message.to_s.match(/throttle/i) || e.message.to_s.match(/rateexceeded/i) rescue false)
      log(:error, "#{description}: ran into throttling - waiting for #{InstanceAgent::Config.config[:wait_after_throttle_error]}s until retrying")
      sleep InstanceAgent::Config.config[:wait_after_throttle_error]
    else
      log(:error, "#{description}: error during start or run: #{e.class} - #{e.message} - #{e.backtrace.join("\n")}")
      sleep 5
    end
  end  
end





InstanceAgentService.new.read_config unless defined?(Ocra)
require 'instance_agent/plugins/codedeploy/register_plugin'

InstanceAgentService.mainloop unless defined?(Ocra)