tus: sentry improvements
## Ticket 910 ## Changes - Change the "message" from a generic "tus-upload" to more specific ones like "tus: failed to resume upload". These are grouped as "Events" in sentry, so we can isolate and search for them easily. - Pass more info to Sentry (previously only available from Slack). It is still good to send to both, since some browsers block Sentry even without blocker extensions. - Reduce verbosity of Slack's ## Notes - Was unable to change the "unknown" problem mentioned in the ticket. The API does not accept `new Error('xxx')`, even though that's being mentioned by many in the forums. It might be due to the version of Sentry that we are using. - To search for tus issues, go to "Issues" and query `message:tus*`. Results are collapsed per event, so click on the item of interest, then click "Events" at the upper right to see all occurrences of the same problem.
This commit is contained in:
parent
cfea97dd96
commit
59e83f3fa8
1 changed files with 10 additions and 3 deletions
|
@ -24,6 +24,15 @@ function inStatusCategory(status, category) {
|
|||
return status >= category && status < category + 100;
|
||||
}
|
||||
|
||||
function getTusErrorType(errMsg: string) {
|
||||
if (errMsg.startsWith('tus: failed to upload chunk at offset')) {
|
||||
// This is the only message that contains dynamic value prior to the first comma.
|
||||
return 'tus: failed to upload chunk at offset';
|
||||
} else {
|
||||
return errMsg.startsWith('tus:') ? errMsg.substring(0, errMsg.indexOf(',')) : errMsg;
|
||||
}
|
||||
}
|
||||
|
||||
export function makeResumableUploadRequest(
|
||||
token: string,
|
||||
params: FileUploadSdkParams,
|
||||
|
@ -86,14 +95,12 @@ export function makeResumableUploadRequest(
|
|||
}
|
||||
|
||||
window.store.dispatch(doUpdateUploadProgress({ guid, status: 'error' }));
|
||||
analytics.sentryError('tus-upload', err);
|
||||
analytics.sentryError(getTusErrorType(errMsg), { onError: err, tusUpload: uploader });
|
||||
|
||||
reject(
|
||||
// $FlowFixMe - flow's constructor for Error is incorrect.
|
||||
new Error(customErr || err, {
|
||||
cause: {
|
||||
url: uploader.url,
|
||||
status,
|
||||
...(uploader._fingerprint ? { fingerprint: uploader._fingerprint } : {}),
|
||||
...(uploader._retryAttempt ? { retryAttempt: uploader._retryAttempt } : {}),
|
||||
...(uploader._offsetBeforeRetry ? { offsetBeforeRetry: uploader._offsetBeforeRetry } : {}),
|
||||
|
|
Loading…
Reference in a new issue