mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 14:15:38 +00:00
The HTTP error code will now be shown on scraper errors instead of the 'File is smaller than 350 bytes' message
This commit is contained in:
parent
0d845ba4af
commit
cfb71c378f
|
@ -194,6 +194,14 @@ HttpReq::HttpReq(const std::string& url, bool scraperRequest)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fail on HTTP status codes >= 400.
|
||||||
|
err = curl_easy_setopt(mHandle, CURLOPT_FAILONERROR, 1L);
|
||||||
|
if (err != CURLE_OK) {
|
||||||
|
mStatus = REQ_IO_ERROR;
|
||||||
|
onError(curl_easy_strerror(err));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Add the handle to our multi.
|
// Add the handle to our multi.
|
||||||
CURLMcode merr {curl_multi_add_handle(sMultiHandle, mHandle)};
|
CURLMcode merr {curl_multi_add_handle(sMultiHandle, mHandle)};
|
||||||
if (merr != CURLM_OK) {
|
if (merr != CURLM_OK) {
|
||||||
|
@ -250,6 +258,12 @@ HttpReq::Status HttpReq::status()
|
||||||
req->mStatus = REQ_FAILED_VERIFICATION;
|
req->mStatus = REQ_FAILED_VERIFICATION;
|
||||||
req->onError(curl_easy_strerror(msg->data.result));
|
req->onError(curl_easy_strerror(msg->data.result));
|
||||||
}
|
}
|
||||||
|
else if (msg->data.result == CURLE_HTTP_RETURNED_ERROR) {
|
||||||
|
req->mStatus = REQ_BAD_STATUS_CODE;
|
||||||
|
long responseCode;
|
||||||
|
curl_easy_getinfo(msg->easy_handle, CURLINFO_RESPONSE_CODE, &responseCode);
|
||||||
|
req->onError("Server returned HTTP error code " + std::to_string(responseCode));
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
req->mStatus = REQ_IO_ERROR;
|
req->mStatus = REQ_IO_ERROR;
|
||||||
req->onError(curl_easy_strerror(msg->data.result));
|
req->onError(curl_easy_strerror(msg->data.result));
|
||||||
|
|
Loading…
Reference in a new issue