mirror of
https://codeberg.org/spire/mapdownloader.git
synced 2026-06-03 18:24:11 +02:00
better download errors
This commit is contained in:
parent
0c1dcb418f
commit
de70afa7e8
2 changed files with 19 additions and 7 deletions
Binary file not shown.
|
|
@ -133,9 +133,9 @@ public onComplete(Handle:hndl, CURLcode:code, any hDLPack) {
|
||||||
ReadPackString(hDLPack, map, sizeof(map));
|
ReadPackString(hDLPack, map, sizeof(map));
|
||||||
ReadPackString(hDLPack, targetPath, sizeof(targetPath));
|
ReadPackString(hDLPack, targetPath, sizeof(targetPath));
|
||||||
CloseHandle(hDLPack);
|
CloseHandle(hDLPack);
|
||||||
CloseHandle(hndl);
|
|
||||||
|
|
||||||
if (code != CURLE_OK) {
|
if (code != CURLE_OK) {
|
||||||
|
CloseHandle(hndl);
|
||||||
PrintToChatAll("Error downloading map %s", map);
|
PrintToChatAll("Error downloading map %s", map);
|
||||||
decl String:sError[256];
|
decl String:sError[256];
|
||||||
curl_easy_strerror(code, sError, sizeof(sError));
|
curl_easy_strerror(code, sError, sizeof(sError));
|
||||||
|
|
@ -143,14 +143,26 @@ public onComplete(Handle:hndl, CURLcode:code, any hDLPack) {
|
||||||
PrintToChatAll("cURL error code: %d", code);
|
PrintToChatAll("cURL error code: %d", code);
|
||||||
DeleteFile(targetPath);
|
DeleteFile(targetPath);
|
||||||
} else {
|
} else {
|
||||||
//PrintToChatAll("map size(%s): %d", targetPath, FileSize(targetPath));
|
new status_code;
|
||||||
if (FileSize(targetPath) < 1024) {
|
curl_easy_getinfo_int(hndl, CURLINFO_RESPONSE_CODE, status_code);
|
||||||
PrintToChatAll("Map file to small, discarding");
|
CloseHandle(hndl);
|
||||||
|
|
||||||
|
if (status_code == 200) {
|
||||||
|
if (FileSize(targetPath) < 1024) {
|
||||||
|
PrintToChatAll("Map file to small, discarding");
|
||||||
|
DeleteFile(targetPath);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
PrintToChatAll("Successfully downloaded map %s", map);
|
||||||
|
changeLevel(map);
|
||||||
|
} else if (status_code == 404) {
|
||||||
|
PrintToChatAll("Map %s not found", map);
|
||||||
DeleteFile(targetPath);
|
DeleteFile(targetPath);
|
||||||
return;
|
} else {
|
||||||
|
DeleteFile(targetPath);
|
||||||
|
PrintToChatAll("Error downloading map %s", map);
|
||||||
|
PrintToChatAll("HTTP error: %d", status_code);
|
||||||
}
|
}
|
||||||
PrintToChatAll("Successfully downloaded map %s", map);
|
|
||||||
changeLevel(map);
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue