mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-10-12 14:16:09 +08:00
[local-sync] Differentiate sync loop & other errors by additional fingerprint info
Summary: If an exception has the same stack trace, by default Sentry will always group it together in the same event. We don't want to do that for sync loop errors---e.g. 'Invalid credentials' errors should not be grouped together with stuff like 'Too many simultaneous connections'. Creating more unique groups will allow us to better evaluate the effect of sync & other bugfixes. Test Plan: writing unit test right now Reviewers: juan, mark Subscribers: Differential Revision: https://phab.nylas.com/D3915
This commit is contained in:
parent
00299e446d
commit
faf44193a7
4 changed files with 13 additions and 8 deletions
|
@ -174,7 +174,8 @@ export default class NylasAPIRequest {
|
||||||
response.statusCode = NylasAPI.TimeoutErrorCodes[0];
|
response.statusCode = NylasAPI.TimeoutErrorCodes[0];
|
||||||
}
|
}
|
||||||
const apiError = new APIError({error, response, body, requestOptions: this.options});
|
const apiError = new APIError({error, response, body, requestOptions: this.options});
|
||||||
NylasEnv.errorLogger.apiDebug(apiError);
|
const fingerprint = ["{{ default }}", "local api", response.statusCode, error.message];
|
||||||
|
NylasEnv.reportError(apiError, {fingerprint: fingerprint});
|
||||||
reject(apiError);
|
reject(apiError);
|
||||||
} else {
|
} else {
|
||||||
if (this.options.ensureOnce === true) {
|
if (this.options.ensureOnce === true) {
|
||||||
|
|
|
@ -176,7 +176,8 @@ class SyncWorker {
|
||||||
if (statusCode >= 500) {
|
if (statusCode >= 500) {
|
||||||
// Even though we don't consider 500s as permanent errors when
|
// Even though we don't consider 500s as permanent errors when
|
||||||
// refreshing tokens, we want to report them
|
// refreshing tokens, we want to report them
|
||||||
NylasEnv.reportError(err)
|
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
|
||||||
|
@ -195,7 +196,8 @@ class SyncWorker {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this._logger.error(`🔃 Unable to refresh access token.`, err);
|
this._logger.error(`🔃 Unable to refresh access token.`, err);
|
||||||
NylasEnv.reportError(err)
|
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 new Error(`Unable to refresh access token, unknown error encountered`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -365,8 +367,9 @@ class SyncWorker {
|
||||||
|
|
||||||
// Step 4 Update account error state
|
// Step 4 Update account error state
|
||||||
const errorJSON = error.toJSON()
|
const errorJSON = error.toJSON()
|
||||||
error.message = `Error in sync loop: ${error.message}`
|
const fingerprint = ["{{ default }}", "sync loop", error.message];
|
||||||
NylasEnv.reportError(error)
|
NylasEnv.reportError(error, {fingerprint: fingerprint});
|
||||||
|
|
||||||
const isAuthError = error instanceof IMAPErrors.IMAPAuthenticationError
|
const isAuthError = error instanceof IMAPErrors.IMAPAuthenticationError
|
||||||
const accountSyncState = isAuthError ? SYNC_STATE_AUTH_FAILED : SYNC_STATE_ERROR;
|
const accountSyncState = isAuthError ? SYNC_STATE_AUTH_FAILED : SYNC_STATE_ERROR;
|
||||||
// TODO this is currently a hack to keep N1's account in sync and notify of
|
// TODO this is currently a hack to keep N1's account in sync and notify of
|
||||||
|
|
|
@ -187,10 +187,10 @@ class SyncbackTaskRunner {
|
||||||
syncbackRequest.status = "NEW";
|
syncbackRequest.status = "NEW";
|
||||||
this._logger.warn(`🔃 📤 ${task.description()} Failed with retryable error, retrying in next loop (${after.getTime() - before.getTime()}ms)`, {syncbackRequest: syncbackRequest.toJSON(), error})
|
this._logger.warn(`🔃 📤 ${task.description()} Failed with retryable error, retrying in next loop (${after.getTime() - before.getTime()}ms)`, {syncbackRequest: syncbackRequest.toJSON(), error})
|
||||||
} else {
|
} else {
|
||||||
error.message = `Syncback Task Failed: ${error.message}`
|
const fingerprint = ["{{ default }}", "syncback task", error.message];
|
||||||
|
NylasEnv.reportError(error, {fingerprint: fingerprint});
|
||||||
syncbackRequest.error = error;
|
syncbackRequest.error = error;
|
||||||
syncbackRequest.status = "FAILED";
|
syncbackRequest.status = "FAILED";
|
||||||
NylasEnv.reportError(error);
|
|
||||||
this._logger.error(`🔃 📤 ${task.description()} Failed (${after.getTime() - before.getTime()}ms)`, {syncbackRequest: syncbackRequest.toJSON(), error})
|
this._logger.error(`🔃 📤 ${task.description()} Failed (${after.getTime() - before.getTime()}ms)`, {syncbackRequest: syncbackRequest.toJSON(), error})
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -151,7 +151,8 @@ class MessageProcessor {
|
||||||
imapMessage,
|
imapMessage,
|
||||||
desiredParts,
|
desiredParts,
|
||||||
})
|
})
|
||||||
NylasEnv.reportError(err)
|
const fingerprint = ["{{ default }}", "message processor", err.message];
|
||||||
|
NylasEnv.reportError(err, {fingerprint: fingerprint})
|
||||||
|
|
||||||
// Keep track of uids we failed to fetch
|
// Keep track of uids we failed to fetch
|
||||||
const {failedUIDs = []} = folder.syncState
|
const {failedUIDs = []} = folder.syncState
|
||||||
|
|
Loading…
Add table
Reference in a new issue