mirror of
https://github.com/wiiu-env/AromaUpdater.git
synced 2025-02-02 14:52:35 +01:00
Improve logging on error
This commit is contained in:
parent
ad337f97fe
commit
afcaeb32f6
@ -31,7 +31,7 @@ int DownloadFilesThreadEntry(UpdaterState *updater) {
|
|||||||
int errorCode;
|
int errorCode;
|
||||||
std::string errorText;
|
std::string errorText;
|
||||||
if (DownloadUtils::DownloadFileToBuffer(curURL, downloadedZIP, responseCode, errorCode, errorText, &updater->mProgress) < 0 || responseCode != 200) {
|
if (DownloadUtils::DownloadFileToBuffer(curURL, downloadedZIP, responseCode, errorCode, errorText, &updater->mProgress) < 0 || responseCode != 200) {
|
||||||
DEBUG_FUNCTION_LINE_ERR("Download failed");
|
DEBUG_FUNCTION_LINE_ERR("Download failed for %s. curl error code %d, error text %s, response code: %d", curURL.c_str(), errorCode, errorText.c_str(), responseCode);
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lockInfo(updater->mDownloadInfosLock);
|
std::lock_guard<std::mutex> lockInfo(updater->mDownloadInfosLock);
|
||||||
updater->mDownloadInfos->state = DownloadInfos::DOWNLOAD_FAILED;
|
updater->mDownloadInfos->state = DownloadInfos::DOWNLOAD_FAILED;
|
||||||
@ -89,7 +89,7 @@ int DownloadFilesThreadEntry(UpdaterState *updater) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!found) {
|
if (!found) {
|
||||||
DEBUG_FUNCTION_LINE_ERR("Failed to find file in zip");
|
DEBUG_FUNCTION_LINE_ERR("Failed to find with hash %s in zip (%s)", curFile.getSha1().c_str(), curURL.c_str());
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lockInfo(updater->mDownloadInfosLock);
|
std::lock_guard<std::mutex> lockInfo(updater->mDownloadInfosLock);
|
||||||
updater->mDownloadInfos->state = DownloadInfos::DOWNLOAD_NOT_FOUND_IN_ZIP;
|
updater->mDownloadInfos->state = DownloadInfos::DOWNLOAD_NOT_FOUND_IN_ZIP;
|
||||||
|
@ -10,14 +10,19 @@
|
|||||||
int DownloadVersionInfoThreadEntry(UpdaterState *updater) {
|
int DownloadVersionInfoThreadEntry(UpdaterState *updater) {
|
||||||
std::lock_guard<std::mutex> lock(updater->mVersionBufferLock);
|
std::lock_guard<std::mutex> lock(updater->mVersionBufferLock);
|
||||||
updater->mProgress = 0.0f;
|
updater->mProgress = 0.0f;
|
||||||
if (DownloadUtils::DownloadFileToBuffer(UPDATE_SERVER_URL "/api/check_versions",
|
std::string url = UPDATE_SERVER_URL "/api/check_versions";
|
||||||
|
if (DownloadUtils::DownloadFileToBuffer(url,
|
||||||
updater->mVersionBuffer,
|
updater->mVersionBuffer,
|
||||||
updater->mResponseCode,
|
updater->mResponseCode,
|
||||||
updater->mDownloadErrorCode,
|
updater->mDownloadErrorCode,
|
||||||
updater->mDownloadErrorText,
|
updater->mDownloadErrorText,
|
||||||
&updater->mProgress) < 0 ||
|
&updater->mProgress) < 0 ||
|
||||||
updater->mResponseCode != 200) {
|
updater->mResponseCode != 200) {
|
||||||
DEBUG_FUNCTION_LINE_ERR("Error while downloading");
|
DEBUG_FUNCTION_LINE_ERR("Error while downloading \"%s\".", url.c_str());
|
||||||
|
DEBUG_FUNCTION_LINE_ERR("curl error code: %d, curl error text %s, response code: %d",
|
||||||
|
updater->mDownloadErrorCode,
|
||||||
|
updater->mDownloadErrorText.c_str(),
|
||||||
|
updater->mResponseCode);
|
||||||
updater->mDownloadInfoResult = UpdaterState::DOWNLOAD_FAILED;
|
updater->mDownloadInfoResult = UpdaterState::DOWNLOAD_FAILED;
|
||||||
} else {
|
} else {
|
||||||
updater->mDownloadInfoResult = UpdaterState::DOWNLOAD_SUCCESS;
|
updater->mDownloadInfoResult = UpdaterState::DOWNLOAD_SUCCESS;
|
||||||
|
@ -139,7 +139,7 @@ int32_t CreateSubfolder(const char *fullpath) {
|
|||||||
int32_t saveBufferToFile(const char *path, void *buffer, uint32_t size) {
|
int32_t saveBufferToFile(const char *path, void *buffer, uint32_t size) {
|
||||||
int fd = open(path, O_CREAT | O_TRUNC | O_WRONLY);
|
int fd = open(path, O_CREAT | O_TRUNC | O_WRONLY);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
DEBUG_FUNCTION_LINE_ERR("Failed to open %s", path);
|
DEBUG_FUNCTION_LINE_ERR("Failed to open %s. %d", path, fd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
auto sizeToWrite = size;
|
auto sizeToWrite = size;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user