1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-12-02 22:49:09 +02:00

Better handling of network errors

This commit is contained in:
Laurent Cozic
2017-07-30 22:22:57 +02:00
parent ad1fbba78d
commit 242b6dbff8
6 changed files with 34 additions and 23 deletions

View File

@@ -69,8 +69,8 @@ class OneDriveApi {
}
async appDirectory() {
let r = await this.execJson('GET', '/drive/special/approot');
return r.parentReference.path + '/' + r.name;
let r = await this.execJson('GET', '/drive/special/approot');
return r.parentReference.path + '/' + r.name;
}
authCodeUrl(redirectUri) {
@@ -172,8 +172,7 @@ class OneDriveApi {
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().warn('Got error below - retrying...');
this.logger().warn(error);
this.logger().info('Got error "Network request failed" - retrying (' + i + ')...');
await time.sleep((i + 1) * 3);
continue;
} else {
@@ -204,8 +203,8 @@ class OneDriveApi {
// type: 'system',
// errno: 'EAGAIN',
// code: 'EAGAIN' }
this.logger().warn('Got error below - retrying...');
this.logger().warn(error);
this.logger().info('Got error below - retrying (' + i + ')...');
this.logger().info(error);
await time.sleep((i + 1) * 3);
continue;
} else if (error.code == 'itemNotFound' && method == 'DELETE') {