Improve handling of Etebase errors.

master
Tom Hacohen 4 years ago
parent b370c59184
commit f2d051a4a6

@ -97,18 +97,16 @@ export class SyncManager {
const stoken = await this.fetchAllCollections(); const stoken = await this.fetchAllCollections();
return stoken; return stoken;
} catch (e) { } catch (e) {
if (e instanceof Etebase.NetworkError) { if (e instanceof Etebase.NetworkError || e instanceof Etebase.TemporaryServerError) {
// Ignore network errors // Ignore network errors
return null; return null;
} else if (e instanceof Etebase.PermissionDeniedError) {
store.dispatch(appendError(e));
return null;
} else if (e instanceof Etebase.HttpError) { } else if (e instanceof Etebase.HttpError) {
switch (e.status) {
case 401: // INVALID TOKEN
case 403: // FORBIDDEN
case 503: // UNAVAILABLE
store.dispatch(appendError(e)); store.dispatch(appendError(e));
return null; return null;
} }
}
throw e; throw e;
} finally { } finally {
this.isSyncing = false; this.isSyncing = false;

Loading…
Cancel
Save