Skip to content

Commit

Permalink
better error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
insomnious committed Jul 13, 2023
1 parent 1b4d976 commit 1a9eb7e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/extensions/nexus_integration/eventHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,12 @@ export function onRefreshUserInfo(api: IExtensionApi) {
api.store.dispatch(setUserInfo(transformUserInfoFromApi(apiUserInfo)));
log('info', 'onRefreshUserInfo()', apiUserInfo);
})
.catch((err) => {
log('error', `onRefreshUserInfo() ${err.message}`, err);
showError(api.store.dispatch, 'An error occurred refreshing user info', err, {
allowReport: false,
});
});
} else {
log('warn', 'onRefreshUserInfo() no oauth token');
}
Expand Down
9 changes: 8 additions & 1 deletion src/extensions/nexus_integration/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1332,8 +1332,15 @@ function updateUserInfo(api: IExtensionApi,
// update state with new info from endpoint
api.store.dispatch(setUserInfo(transformUserInfoFromApi(apiUserInfo)));
log('info', 'apiUserInfo', apiUserInfo);
return true;
})
.then(() => true);
.catch((err) => {
log('error', `onRefreshUserInfo() ${err.message}`, err);
showError(api.store.dispatch, 'An error occurred refreshing user info', err, {
allowReport: false,
});
return false;
});
} else {
log('warn', 'updateUserInfo() no oauth token');
}
Expand Down

0 comments on commit 1a9eb7e

Please sign in to comment.