mirror of
https://github.com/abraunegg/onedrive
synced 2024-05-18 05:36:41 +02:00
Update error catching and handling
* Update error catching and handling
This commit is contained in:
parent
68cc51ab4d
commit
cc2b8085f5
|
@ -493,8 +493,17 @@ final class OneDriveApi
|
|||
{
|
||||
checkAccessTokenExpired();
|
||||
scope(failure) {
|
||||
if (exists(saveToPath)) remove(saveToPath);
|
||||
if (exists(saveToPath)) {
|
||||
// try and remove the file, catch error
|
||||
try {
|
||||
remove(saveToPath);
|
||||
} catch (FileException e) {
|
||||
// display the error message
|
||||
displayFileSystemErrorMessage(e.msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Create the directory
|
||||
string newPath = dirName(saveToPath);
|
||||
mkdirRecurse(newPath);
|
||||
|
@ -803,6 +812,7 @@ final class OneDriveApi
|
|||
{
|
||||
// Threshold for displaying download bar
|
||||
long thresholdFileSize = 4 * 2^^20; // 4 MiB
|
||||
// open file as write in binary mode
|
||||
auto file = File(filename, "wb");
|
||||
|
||||
// function scopes
|
||||
|
|
|
@ -2565,7 +2565,6 @@ final class SyncEngine
|
|||
log.vdebug("onedrive.downloadById(item.driveId, item.id, path, fileSize); generated a OneDriveException");
|
||||
// 408 = Request Time Out
|
||||
// 429 = Too Many Requests - need to delay
|
||||
|
||||
if (e.httpStatusCode == 408) {
|
||||
// 408 error handling - request time out
|
||||
// https://github.com/abraunegg/onedrive/issues/694
|
||||
|
@ -2637,6 +2636,12 @@ final class SyncEngine
|
|||
}
|
||||
}
|
||||
}
|
||||
} catch (FileException e) {
|
||||
// There was a file system error
|
||||
// display the error message
|
||||
displayFileSystemErrorMessage(e.msg);
|
||||
downloadFailed = true;
|
||||
return;
|
||||
} catch (std.exception.ErrnoException e) {
|
||||
// There was a file system error
|
||||
// display the error message
|
||||
|
|
Loading…
Reference in a new issue