Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop sending chromeos errors to sentry #2293

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/util/handleError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,14 @@ const logServerError = async (
const err = getErrorLog(error, ctx);
switch (logLevel) {
case "info":
await log.info(err);
log.info(err);
break;
case "warn":
await log.warn(err);
log.warn(err);
break;
case "error":
case undefined:
await log.error(err);
log.error(err);
break;
default:
unreachable(logLevel);
Expand Down
40 changes: 30 additions & 10 deletions src/util/sentry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,46 @@ const isInformationalError = (exception: unknown): boolean => {
};

const sentryIgnoreErrors = [
// Network problems
"Failed to fetch",
gunnarvelle marked this conversation as resolved.
Show resolved Hide resolved
// https://github.com/getsentry/sentry/issues/61469
'Object.prototype.hasOwnProperty.call(o,"telephone")',
'Object.prototype.hasOwnProperty.call(e,"telephone")',
// https://github.com/matomo-org/matomo/issues/22836
"'get' on proxy: property 'javaEnabled' is a read-only and non-configurable data property",
// Based on Sentry issues. ChromeOS specific errors.
"Request timeout getDictionariesByLanguageId",
"Request timeout getSupportScreenShot",
"Request timeout isDictateAvailable",
"Request timeout isPredictionAvailable",
"Request timeout dictionariesDistributor.getValue",
"Request timeout speechVoicesDistributor.getValue",
"Request timeout userDistributor.getValue",
"Request timeout predictionDistributor.getValue",
"Request timeout dictateStateDistributor.getValue",
"Request timeout nn-NO_wordsDistributor.getValue",
"Request timeout availableTextCheckLanguagesDistributor.getValue",
"Request timeout es_wordsDistributor.getValue",
"Request timeout lettersVoicesDistributor.getValue",
"Request timeout topicsDistributor.getValue",
"Request timeout availableLanguagesDistributor.getValue",
"Request timeout ac_wordsDistributor.getValue",
"Request timeout nb-NO_wordsDistributor.getValue",
"Request timeout ua_wordsDistributor.getValue",
"Request timeout en_wordsDistributor.getValue",
"Request timeout appSettingsDistributor.getValue",
"Request timeout DefineExpirationForLanguagePacks.getValue",
"Request timeout textCheckersDistributor.getValue",
"Request timeout de_wordsDistributor.getValue",
"Request timeout fr_wordsDistributor.getValue",
"Request timeout ru_wordsDistributor.getValue",
gunnarvelle marked this conversation as resolved.
Show resolved Hide resolved
];

export const beforeSend = (event: Sentry.ErrorEvent, hint: Sentry.EventHint) => {
const exception = hint.originalException;
const infoError = isInformationalError(exception);
if (infoError) return null;

if (
exception instanceof Error &&
(exception.message === "Failed to fetch" || exception.message === "[Network error]: Failed to fetch")
) {
// Don't send network errors without more information
// These are not really something we can fix, usually triggered by exceptions blocking requests
// so logging them shouldn't provide much value.
return null;
}

if (exception instanceof Error && sentryIgnoreErrors.find((e) => exception.message.includes(e)) !== undefined) {
// https://github.com/getsentry/sentry/issues/61469
// https://github.com/matomo-org/matomo/issues/22836
Expand Down
Loading