Added more error messages.

This commit is contained in:
tastytea 2019-04-17 07:12:08 +02:00
parent 5b28fd62f3
commit ed54b27716
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07

View File

@ -110,9 +110,10 @@ int main(int argc, char *argv[])
const char *envbaseurl = std::getenv("GITEA2RSS_BASEURL");
if (envbaseurl == nullptr)
{
cerr << "Error: GITEA2RSS_BASEURL not set\n";
return 1;
}
size_t pos = query.find("repo=");
const size_t pos = query.find("repo=");
url = string(envbaseurl) + "/" + query.substr(query.find('=', pos) + 1);
cout << "Content-Type: application/rss+xml\n\n";
}
@ -136,6 +137,11 @@ int main(int argc, char *argv[])
const string now = strtime(system_clock::now());
stringstream data(get_http(baseurl + "/api/v1/repos/"
+ repo + "/releases"));
if (data.str().empty())
{
cerr << "Error: Could not download releases.\n";
return 2;
}
Json::Value json;
data >> json;