Added a more informative error message than 'HTTP error code 430' when exceeding the daily ScreenScraper quota

This commit is contained in:
Leon Styhre 2024-03-02 15:49:43 +01:00
parent 5560ca9408
commit 83baa5b5d0
2 changed files with 8 additions and 3 deletions

View file

@ -35,7 +35,7 @@ namespace
std::unique_ptr<ScraperSearchHandle> startScraperSearch(const ScraperSearchParams& params) std::unique_ptr<ScraperSearchHandle> startScraperSearch(const ScraperSearchParams& params)
{ {
std::string name = Settings::getInstance()->getString("Scraper"); std::string name {Settings::getInstance()->getString("Scraper")};
// Handle a potentially invalid entry in the configuration file. // Handle a potentially invalid entry in the configuration file.
if (name != "screenscraper" && name != "thegamesdb") { if (name != "screenscraper" && name != "thegamesdb") {
name = "screenscraper"; name = "screenscraper";

View file

@ -263,7 +263,12 @@ HttpReq::Status HttpReq::status()
long responseCode; long responseCode;
curl_easy_getinfo(msg->easy_handle, CURLINFO_RESPONSE_CODE, &responseCode); curl_easy_getinfo(msg->easy_handle, CURLINFO_RESPONSE_CODE, &responseCode);
if (responseCode == 404 && mScraperRequest && if (responseCode == 430 &&
Settings::getInstance()->getString("Scraper") == "screenscraper") {
req->mContent << "You have exceeded your daily scrape quota";
req->mStatus = REQ_SUCCESS;
}
else if (responseCode == 404 && mScraperRequest &&
Settings::getInstance()->getBool("ScraperIgnoreHTTP404Errors")) { Settings::getInstance()->getBool("ScraperIgnoreHTTP404Errors")) {
req->mStatus = REQ_RESOURCE_NOT_FOUND; req->mStatus = REQ_RESOURCE_NOT_FOUND;
} }