Wrap await calls in try/catch (#4418)

* Wrap await calls in try/catch

* Fix spacing
This commit is contained in:
Miguel Alatzar 2020-06-12 13:08:22 -07:00 committed by GitHub
parent 3c03b0c13b
commit 67978382e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 3 deletions

View file

@ -170,7 +170,11 @@ class GlobalEventHandler {
resetMomentLocale();
// TODO: Handle when multi-server support is added
await CookieManager.clearAll(Platform.OS === 'ios');
try {
await CookieManager.clearAll(Platform.OS === 'ios');
} catch (error) {
// Nothing to clear
}
PushNotifications.clearNotifications();
const cacheDir = RNFetchBlob.fs.dirs.CacheDir;
const mainPath = cacheDir.split('/').slice(0, -1).join('/');

View file

@ -50,7 +50,11 @@ export default class LoginOptions extends PureComponent {
const {intl} = this.context;
const screen = 'Login';
const title = intl.formatMessage({id: 'mobile.routes.login', defaultMessage: 'Login'});
await CookieManager.clearAll(Platform.OS === 'ios');
try {
await CookieManager.clearAll(Platform.OS === 'ios');
} catch (error) {
// Nothing to clear
}
goToScreen(screen, title);
});
@ -58,7 +62,11 @@ export default class LoginOptions extends PureComponent {
const {intl} = this.context;
const screen = 'SSO';
const title = intl.formatMessage({id: 'mobile.routes.sso', defaultMessage: 'Single Sign-On'});
await CookieManager.clearAll(Platform.OS === 'ios');
try {
await CookieManager.clearAll(Platform.OS === 'ios');
} catch (error) {
// Nothing to clear
}
goToScreen(screen, title, {ssoType});
};