Skip to content

Commit

Permalink
Properly detect http errors when ingesting over the network
Browse files Browse the repository at this point in the history
  • Loading branch information
gibber9809 committed Dec 19, 2024
1 parent 561634c commit 307be9e
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions components/core/src/clp_s/JsonParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
#include <memory>
#include <stack>

#include <curl/curl.h>
#include <simdjson.h>
#include <spdlog/spdlog.h>

#include "../clp/NetworkReader.hpp"
#include "../clp/ReaderInterface.hpp"
#include "archive_constants.hpp"
#include "JsonFileIterator.hpp"
Expand Down Expand Up @@ -542,6 +544,23 @@ bool JsonParser::parse() {
path.path
);
}

if (auto network_reader = std::dynamic_pointer_cast<clp::NetworkReader>(reader);
nullptr != network_reader)
{
if (auto const rc = network_reader->get_curl_ret_code();
rc.has_value() && CURLcode::CURLE_OK != rc.value())
{
auto curl_error_message = network_reader->get_curl_error_msg();
std::string error_msg_str;
if (curl_error_message.has_value()) {
error_msg_str = curl_error_message.value();
}
SPDLOG_ERROR("Encountered curl error during ingestion - {}", error_msg_str);
}
m_archive_writer->close();
return false;
}
}
return true;
}
Expand Down

0 comments on commit 307be9e

Please sign in to comment.