From bb71c5cdf8548fd189ba0bd8cb6c6e2a9b406679 Mon Sep 17 00:00:00 2001 From: Simon Quigley Date: Thu, 19 Dec 2024 00:28:06 -0600 Subject: [PATCH] continue on CURL errors --- src/launchpad.cpp | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/src/launchpad.cpp b/src/launchpad.cpp index 8b0ff4c..b12c271 100644 --- a/src/launchpad.cpp +++ b/src/launchpad.cpp @@ -272,21 +272,13 @@ std::optional launchpad::api_get(const std::string endpoint, const while (tries < 5) { tries++; CURLcode res = curl_easy_perform(curl); - if (res != CURLE_OK) { - std::cerr << "CURL GET error: " << curl_easy_strerror(res) << std::endl; - } + if (res != CURLE_OK) { continue; } curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &http_code); curl_slist_free_all(headers); curl_easy_cleanup(curl); - if (res != CURLE_OK) { - continue; - } - - if (http_code >= 400) { - continue; - } + if (res != CURLE_OK || http_code >= 400) { continue; } return readBuffer; } @@ -358,21 +350,13 @@ std::optional launchpad::api_post( while (tries < 5) { tries++; CURLcode res = curl_easy_perform(curl); - if (res != CURLE_OK) { - std::cerr << "CURL POST error: " << curl_easy_strerror(res) << std::endl; - } + if (res != CURLE_OK) { continue; } curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &http_code); curl_slist_free_all(headers); curl_easy_cleanup(curl); - if (res != CURLE_OK) { - continue; - } - - if (http_code >= 400) { - continue; - } + if (res != CURLE_OK || http_code >= 400) { continue; } return readBuffer; }