Skip to content

Commit 590c525

Browse files
abhinavk96kushthedude
authored andcommitted
fix: wrap async calls in try-catch (#3275)
1 parent 3b3817e commit 590c525

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

app/services/auth-manager.js

+10-3
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,16 @@ export default Service.extend({
9898
async initialize() {
9999
if (this.get('session.isAuthenticated')) {
100100
if (this.get('session.data.currentUserFallback.id')) {
101-
const user = await this.store.findRecord('user', this.get('session.data.currentUserFallback.id'));
102-
this.set('currentUserModel', user);
103-
this.identify();
101+
try {
102+
const user = await this.store.findRecord('user', this.get('session.data.currentUserFallback.id'));
103+
this.set('currentUserModel', user);
104+
this.identify();
105+
} catch (e) {
106+
console.warn(e);
107+
this.session.invalidate();
108+
this.notify.error(this.l10n.t('An unexpected error has occurred'));
109+
}
110+
104111
} else {
105112
this.identifyStranger();
106113
}

0 commit comments

Comments
 (0)