feat(mini): v4.0.8 客服卡片主包落地、定位误报修复,合伙人微信内预览保存海报
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -21,6 +21,14 @@ export type ClientErrorPayload = {
|
||||
extra?: Record<string, unknown>;
|
||||
};
|
||||
|
||||
/** 微信预期失败,不应按 P1 未捕获上报 */
|
||||
const IGNORED_REJECTION =
|
||||
/getLocation:fail|hideToast:fail:toast can't be found|showToast:fail|authorize:fail auth deny/i;
|
||||
|
||||
function shouldIgnoreRejection(message: string): boolean {
|
||||
return IGNORED_REJECTION.test(message);
|
||||
}
|
||||
|
||||
function currentPagePath(): string | undefined {
|
||||
try {
|
||||
const pages = Taro.getCurrentPages();
|
||||
@@ -97,6 +105,7 @@ export function installClientErrorReporting(): void {
|
||||
: typeof reason === 'string'
|
||||
? reason
|
||||
: JSON.stringify(reason);
|
||||
if (shouldIgnoreRejection(message || '')) return;
|
||||
const stack = reason instanceof Error ? reason.stack : undefined;
|
||||
reportClientError({
|
||||
level: 'error',
|
||||
@@ -121,15 +130,17 @@ export function installClientErrorReporting(): void {
|
||||
});
|
||||
window.addEventListener('unhandledrejection', (ev) => {
|
||||
const reason = ev.reason;
|
||||
const message =
|
||||
reason instanceof Error
|
||||
? reason.message
|
||||
: typeof reason === 'string'
|
||||
? reason
|
||||
: 'unhandledrejection';
|
||||
if (shouldIgnoreRejection(message)) return;
|
||||
reportClientError({
|
||||
level: 'error',
|
||||
category: 'unhandled_rejection',
|
||||
message:
|
||||
reason instanceof Error
|
||||
? reason.message
|
||||
: typeof reason === 'string'
|
||||
? reason
|
||||
: 'unhandledrejection',
|
||||
message,
|
||||
stack: reason instanceof Error ? reason.stack : undefined,
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user