From 8eea5fa8acaab1320fe39b30bc76c9b1a683e92b Mon Sep 17 00:00:00 2001 From: Juan Tejada Date: Mon, 6 Mar 2017 08:22:23 -0800 Subject: [PATCH] [client-sync] Improve reporting of refresh access token errors Summary: Add better messaging and logging to the console. Depends on D4098 Test Plan: manual Reviewers: evan, khamidou, spang Reviewed By: spang Differential Revision: https://phab.nylas.com/D4099 --- packages/client-sync/src/local-sync-worker/sync-worker.es6 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/client-sync/src/local-sync-worker/sync-worker.es6 b/packages/client-sync/src/local-sync-worker/sync-worker.es6 index c22ea796d..d52d8daf4 100644 --- a/packages/client-sync/src/local-sync-worker/sync-worker.es6 +++ b/packages/client-sync/src/local-sync-worker/sync-worker.es6 @@ -188,6 +188,7 @@ class SyncWorker { } return null } catch (err) { + this._logger.warn(`🔃 Unable to refresh access token.`, err); if (err instanceof APIError) { const {statusCode} = err this._logger.error(`🔃 Unable to refresh access token. Got status code: ${statusCode}`, err); @@ -208,10 +209,10 @@ class SyncWorker { throw new IMAPErrors.IMAPAuthenticationError(`Unable to refresh access token`); } } - this._logger.error(`🔃 Unable to refresh access token.`, err); + err.message = `Unknown error when refreshing access token: ${err.message}` const fingerprint = ["{{ default }}", "access token refresh", err.message]; NylasEnv.reportError(err, {fingerprint: fingerprint}) - throw new Error(`Unable to refresh access token, unknown error encountered`); + throw err } }