1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-29 22:48:10 +02:00

Fixed OneDrive connection issue

This commit is contained in:
Laurent Cozic
2017-07-13 18:09:47 +00:00
parent bde42a80b6
commit e397ad197d
6 changed files with 181 additions and 66 deletions

View File

@@ -167,9 +167,16 @@ class OneDriveApi {
response = await shim.fetchBlob(url, options);
}
} catch (error) {
// TEMPORARY: To try to find where uncaught error comes from
let error = new Error('OneDrive API caught: ' + JSON.stringify(error));
throw error;
if (error.message == 'Network request failed') {
// Unfortunately the error 'Network request failed' doesn't have a type
// or error code, so hopefully that message won't change and is not localized
this.logger().info('Got error below - retrying...');
this.logger().info(error);
await time.sleep((i + 1) * 3);
continue;
} else {
throw error;
}
}
if (!response.ok) {
@@ -197,7 +204,7 @@ class OneDriveApi {
// code: 'EAGAIN' }
this.logger().info('Got error below - retrying...');
this.logger().info(error);
await time.msleep(1000 * i);
await time.sleep((i + 1) * 3);
continue;
} else if (error.code == 'itemNotFound' && method == 'DELETE') {
// Deleting a non-existing item is ok - noop