From 2c6e3c4db55f9ce3d82663b812bea0dc903fbcfa Mon Sep 17 00:00:00 2001 From: Ben Gotow Date: Tue, 25 Aug 2015 11:49:51 -0700 Subject: [PATCH] fix(sentry-2518): Better debugging information for when token is not found --- .../preferences/lib/tabs/preferences-accounts.cjsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/internal_packages/preferences/lib/tabs/preferences-accounts.cjsx b/internal_packages/preferences/lib/tabs/preferences-accounts.cjsx index 5279c6951..8a688b5f7 100644 --- a/internal_packages/preferences/lib/tabs/preferences-accounts.cjsx +++ b/internal_packages/preferences/lib/tabs/preferences-accounts.cjsx @@ -107,10 +107,14 @@ class PreferencesAccounts extends React.Component return [] unless @props.config tokens = @props.config.get('tokens') || [] - token = _.find tokens, (token) -> - token.provider is 'nylas' and token.identifier is account.emailAddress + token = _.find tokens, (t) -> + t.provider is 'nylas' and t.identifier is account.emailAddress tokens = _.without(tokens, token) + if not token + console.warn("Could not find nylas token for email address #{account.emailAddress}") + return + DatabaseStore.unpersistModel(account).then => # TODO: Delete other mail data EdgehillAPI.unlinkToken(token)