From f2d051a4a6fef35b42720b31da077b8728f36b06 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Fri, 4 Sep 2020 12:00:16 +0300 Subject: [PATCH] Improve handling of Etebase errors. --- src/sync/SyncManager.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/sync/SyncManager.ts b/src/sync/SyncManager.ts index 8185a4f..c5d1711 100644 --- a/src/sync/SyncManager.ts +++ b/src/sync/SyncManager.ts @@ -97,17 +97,15 @@ export class SyncManager { const stoken = await this.fetchAllCollections(); return stoken; } catch (e) { - if (e instanceof Etebase.NetworkError) { + if (e instanceof Etebase.NetworkError || e instanceof Etebase.TemporaryServerError) { // Ignore network errors return null; + } else if (e instanceof Etebase.PermissionDeniedError) { + store.dispatch(appendError(e)); + return null; } else if (e instanceof Etebase.HttpError) { - switch (e.status) { - case 401: // INVALID TOKEN - case 403: // FORBIDDEN - case 503: // UNAVAILABLE - store.dispatch(appendError(e)); - return null; - } + store.dispatch(appendError(e)); + return null; } throw e; } finally {