mirror of
https://github.com/abraunegg/onedrive
synced 2024-06-03 06:22:18 +02:00
Handle OneDrive error response on creating upload session (#556)
* Add a try block when attempting to create the upload session and handle if there is an error response from OneDrive * Should return a JSONValue regardless of error
This commit is contained in:
parent
14fb1ca637
commit
15a2749382
17
src/upload.d
17
src/upload.d
|
@ -39,10 +39,19 @@ struct UploadSession
|
||||||
])
|
])
|
||||||
];
|
];
|
||||||
|
|
||||||
session = onedrive.createUploadSession(parentDriveId, parentId, filename, eTag, fileSystemInfo);
|
try {
|
||||||
session["localPath"] = localPath;
|
// Try to create the upload session for this file
|
||||||
save();
|
session = onedrive.createUploadSession(parentDriveId, parentId, filename, eTag, fileSystemInfo);
|
||||||
return upload();
|
session["localPath"] = localPath;
|
||||||
|
save();
|
||||||
|
return upload();
|
||||||
|
} catch (OneDriveException e) {
|
||||||
|
// there was an error
|
||||||
|
log.vlog("Create file upload session failed ... skipping file upload");
|
||||||
|
// return upload() will return a JSONValue response, create an empty JSONValue response to return
|
||||||
|
JSONValue response;
|
||||||
|
return response;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Restore the previous upload session.
|
/* Restore the previous upload session.
|
||||||
|
|
Loading…
Reference in a new issue