mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
tune rollbar rules
This commit is contained in:
+12
-1
@@ -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),
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}, []);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user