with_error_handling

in lib/instance_agent/runner/child.rb [76:91]


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