Add enhanced debugging for missing endpoints
This commit is contained in:
parent
97840881fe
commit
d7f83d4b46
@ -220,7 +220,16 @@ std::string launchpad::build_full_url(const std::string& endpoint) const {
|
|||||||
|
|
||||||
std::optional<std::string> launchpad::api_get(const std::string& endpoint, const std::map<std::string, std::string>& params) const {
|
std::optional<std::string> launchpad::api_get(const std::string& endpoint, const std::map<std::string, std::string>& params) const {
|
||||||
std::string url = build_full_url(endpoint);
|
std::string url = build_full_url(endpoint);
|
||||||
if (url.empty()) { return std::nullopt; }
|
if (url.empty()) {
|
||||||
|
std::cerr << "Internal error: please include the following info in a bug report:" << std::endl;
|
||||||
|
if (!params.empty()) {
|
||||||
|
for (const auto& [key, value] : params) {
|
||||||
|
std::cerr << url_encode(key) + "=" + url_encode(value) + "&";
|
||||||
|
}
|
||||||
|
std::cerr << std::endl;
|
||||||
|
}
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
if (!params.empty()) {
|
if (!params.empty()) {
|
||||||
url += "?";
|
url += "?";
|
||||||
for (const auto& [key, value] : params) {
|
for (const auto& [key, value] : params) {
|
||||||
@ -292,8 +301,17 @@ std::optional<std::string> launchpad::api_post(
|
|||||||
bool build_endpoint,
|
bool build_endpoint,
|
||||||
const std::string& token_secret_override
|
const std::string& token_secret_override
|
||||||
) {
|
) {
|
||||||
|
if (endpoint.empty()) {
|
||||||
|
std::cerr << "Internal error: please include the following info in a bug report:" << std::endl;
|
||||||
|
if (!params.empty()) {
|
||||||
|
for (const auto& [key, value] : params) {
|
||||||
|
std::cerr << url_encode(key) + "=" + url_encode(value) + "&";
|
||||||
|
}
|
||||||
|
std::cerr << std::endl;
|
||||||
|
}
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
std::string url = build_endpoint ? build_full_url(endpoint) : endpoint;
|
std::string url = build_endpoint ? build_full_url(endpoint) : endpoint;
|
||||||
if (url.empty()) { return std::nullopt; }
|
|
||||||
|
|
||||||
CURL* curl = curl_easy_init();
|
CURL* curl = curl_easy_init();
|
||||||
if (!curl) {
|
if (!curl) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user