tune rollbar rules

This commit is contained in:
tom
2026-02-24 12:25:56 +01:00
parent 40ccfd77aa
commit e3fca9fa44
3 changed files with 22 additions and 3 deletions
+12 -1
View File
@@ -6,7 +6,7 @@ import config from 'configs/app';
import { ABSENT_PARAM_ERROR_MESSAGE } from 'lib/errors/throwOnAbsentParamError';
import { RESOURCE_LOAD_ERROR_MESSAGE } from 'lib/errors/throwOnResourceLoadError';
import { isBot, isHeadlessBrowser, isNextJsChunkError, getRequestInfo, getExceptionClass } from './utils';
import { isBot, isHeadlessBrowser, isNextJsChunkError, getRequestInfo, getExceptionClass, getExceptionOriginFileName } from './utils';
const feature = config.features.rollbar;
@@ -44,12 +44,23 @@ export const clientConfig: Configuration | undefined = feature.isEnabled ? {
// one of the examples - https://github.com/facebook/react/issues/11538
// we can ignore them for now
'NotFoundError',
'AbortError',
];
if (exceptionClass && IGNORED_EXCEPTION_CLASSES.includes(exceptionClass)) {
return true;
}
const originFileName = getExceptionOriginFileName(item);
const IGNORED_ORIGIN_FILE_NAMES_CHUNKS = [
'/node_modules/@walletconnect',
];
if (originFileName && IGNORED_ORIGIN_FILE_NAMES_CHUNKS.some((chunk) => originFileName.includes(chunk))) {
return true;
}
return false;
},
hostSafeList: [ config.app.host ].filter(Boolean),
+9 -1
View File
@@ -1,6 +1,8 @@
import { get } from 'es-toolkit/compat';
import type { Dictionary } from 'rollbar';
import { castToString } from 'toolkit/utils/guards';
export function isBot(userAgent: string | undefined) {
if (!userAgent) return false;
@@ -61,5 +63,11 @@ export function getRequestInfo(item: Dictionary): { url: string } | undefined {
export function getExceptionClass(item: Dictionary) {
const exceptionClass = get(item, 'body.trace.exception.class');
return typeof exceptionClass === 'string' ? exceptionClass : undefined;
return castToString(exceptionClass);
}
export function getExceptionOriginFileName(item: Dictionary) {
const originFileName = get(item, 'body.trace.frames[0].filename');
return castToString(originFileName);
}
+1 -1
View File
@@ -36,7 +36,7 @@ export default function useDetectWalletEip6963() {
.find(([ , rdns ]) => rdns === event.detail.info.rdns)?.[0] as WalletType | undefined;
if (wallet && !DETECTED_PROVIDERS[wallet]) {
DETECTED_PROVIDERS[wallet] = event.detail.provider;
DETECTED_PROVIDERS[wallet] = event.detail?.provider;
}
}, []);