Skip to content

Commit 3528d2d

Browse files
committed
add failure message check
1 parent b9d243e commit 3528d2d

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

packages/rrweb/src/record/index.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -621,12 +621,19 @@ function record<T = eventWithTime>(
621621
try {
622622
handler();
623623
} catch (error) {
624+
const msg = String(error).toLowerCase();
624625
/**
626+
* https://github.com/rrweb-io/rrweb/pull/1695
625627
* This error can occur in a known scenario:
626-
* If an iframe is initially same-origin and observed, but later its src attribute is changed to a cross-origin URL,
627-
* attempting to execute the handler in the stop record function will throw a "cannot access cross-origin frame" error.
628+
* If an iframe is initially same-origin and observed, but later its
629+
src attribute is changed to a cross-origin URL,
630+
* attempting to execute the handler in the stop record function will
631+
throw a "cannot access cross-origin frame" error.
628632
* This error is expected and can be safely ignored.
629633
*/
634+
if (!msg.includes('cross-origin')) {
635+
console.warn(error);
636+
}
630637
}
631638
});
632639
processedNodeManager.destroy();

0 commit comments

Comments
 (0)