mirror of
https://github.com/abraunegg/onedrive
synced 2024-05-20 22:56:36 +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);
|
||||
session["localPath"] = localPath;
|
||||
save();
|
||||
return upload();
|
||||
try {
|
||||
// Try to create the upload session for this file
|
||||
session = onedrive.createUploadSession(parentDriveId, parentId, filename, eTag, fileSystemInfo);
|
||||
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.
|
||||
|
|
Loading…
Reference in a new issue