Improve handling of Etebase errors.

master
Tom Hacohen 4 years ago
parent b370c59184
commit f2d051a4a6

@ -97,17 +97,15 @@ 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) { store.dispatch(appendError(e));
case 401: // INVALID TOKEN return null;
case 403: // FORBIDDEN
case 503: // UNAVAILABLE
store.dispatch(appendError(e));
return null;
}
} }
throw e; throw e;
} finally { } finally {

Loading…
Cancel
Save