class Honeybadger::Worker

def handle_response(msg, response)

def handle_response(msg, response)
  d { sprintf('worker response id=%s code=%s message=%s', msg.id, response.code, response.message.to_s.dump) }
  case response.code
  when 429, 503
    throttle = inc_throttle
    warn { sprintf('Error report failed: project is sending too many errors. id=%s code=%s throttle=%s interval=%s', msg.id, response.code, throttle, throttle_interval) }
  when 402
    warn { sprintf('Error report failed: payment is required. id=%s code=%s', msg.id, response.code) }
    suspend(3600)
  when 403
    warn { sprintf('Error report failed: API key is invalid. id=%s code=%s', msg.id, response.code) }
    suspend(3600)
  when 201
    if throttle = dec_throttle
      info { sprintf('Success ⚡ https://app.honeybadger.io/notice/%s id=%s code=%s throttle=%s interval=%s', msg.id, msg.id, response.code, throttle, throttle_interval) }
    else
      info { sprintf('Success ⚡ https://app.honeybadger.io/notice/%s id=%s code=%s', msg.id, msg.id, response.code) }
    end
  when :stubbed
    info { sprintf('Success ⚡ Development mode is enabled; this error will be reported if it occurs after you deploy your app. id=%s', msg.id) }
  when :error
    warn { sprintf('Error report failed: an unknown error occurred. code=%s error=%s', response.code, response.message.to_s.dump) }
  else
    warn { sprintf('Error report failed: unknown response from server. code=%s', response.code) }
  end
end