[client-sync] Don't double report refresh access token API errors

Summary:
Given that NylasAPIRequest reports all APIErrors for requests that
return 5xx, we were double reporting access token errors, which caused 2
groups in sentry and makes it difficult to track.

This commit removes the extra reporting for that error in the sync loop

Test Plan: manual

Reviewers: evan, khamidou, spang

Reviewed By: spang

Differential Revision: https://phab.nylas.com/D4098
This commit is contained in:
Juan Tejada 2017-03-06 08:15:05 -08:00
parent 8bd686bc6e
commit a041b79aaa
2 changed files with 1 additions and 7 deletions

View file

@ -124,7 +124,7 @@ export default class NylasAPIRequest {
] ]
if (!ignorableStatusCodes.includes(apiError.statusCode)) { if (!ignorableStatusCodes.includes(apiError.statusCode)) {
const msg = apiError.message || `Unknown Error: ${apiError}` const msg = apiError.message || `Unknown Error: ${apiError}`
const fingerprint = ["{{ default }}", "local api", apiError.statusCode, msg]; const fingerprint = ["{{ default }}", "api error", apiError.statusCode, msg];
NylasEnv.reportError(apiError, {fingerprint: fingerprint}); NylasEnv.reportError(apiError, {fingerprint: fingerprint});
apiError.reported = true apiError.reported = true
} }

View file

@ -192,12 +192,6 @@ class SyncWorker {
const {statusCode} = err const {statusCode} = err
this._logger.error(`🔃 Unable to refresh access token. Got status code: ${statusCode}`, err); this._logger.error(`🔃 Unable to refresh access token. Got status code: ${statusCode}`, err);
if (statusCode >= 500) {
// Even though we don't consider 500s as permanent errors when
// refreshing tokens, we want to report them
const fingerprint = ["{{ default }}", "access token refresh", statusCode, err.message];
NylasEnv.reportError(err, {fingerprint: fingerprint})
}
const isNonPermanentError = ( const isNonPermanentError = (
// If we got a 5xx error from the server, that means that something is wrong // If we got a 5xx error from the server, that means that something is wrong
// on the Nylas API side. It could be a bad deploy, or a bug on Google's side. // on the Nylas API side. It could be a bad deploy, or a bug on Google's side.