Move an error inside a conditional

This commit is contained in:
Simon Quigley 2024-12-16 21:44:02 -06:00
parent 1e7694df63
commit 374da51607

View File

@ -221,8 +221,8 @@ 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::string url = build_full_url(endpoint);
if (url.empty()) {
std::cerr << "Internal error: please include the following info in a bug report:" << std::endl;
if (!params.empty()) {
std::cerr << "Internal error: please include the following info in a bug report:" << std::endl;
for (const auto& [key, value] : params) {
std::cerr << url_encode(key) + "=" + url_encode(value) + "&";
}
@ -302,8 +302,8 @@ std::optional<std::string> launchpad::api_post(
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()) {
std::cerr << "Internal error: please include the following info in a bug report:" << std::endl;
for (const auto& [key, value] : params) {
std::cerr << url_encode(key) + "=" + url_encode(value) + "&";
}