Skip to content

Commit 15a57e2

Browse files
committed
Update ScreenCapture.js
1 parent 5052318 commit 15a57e2

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/ScreenCapture.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,9 @@ const deepClone = async (host) => {
368368
const cloneNode = async (node, parent, shadowRoot) => {
369369
const walkTree = async (nextn, nextp, innerShadowRoot) => {
370370
while (nextn) {
371-
await cloneNode(nextn, nextp, innerShadowRoot);
371+
try {
372+
await cloneNode(nextn, nextp, innerShadowRoot);
373+
} catch (exp) { }
372374

373375
// Fix missing element nodes.
374376
if (
@@ -467,6 +469,7 @@ const deepClone = async (host) => {
467469

468470
const prepareScreenshotData = (remote) => {
469471
return new Promise(async (resolve, reject) => {
472+
try {
470473
const styleTags = window.document.querySelectorAll('style, link');
471474
for (var i = 0; i < styleTags.length; ++i) {
472475
styleTags[i].setAttribute('bb-styleid', i);
@@ -549,5 +552,9 @@ const prepareScreenshotData = (remote) => {
549552
isMobile: isMobile(),
550553
});
551554
});
555+
} catch (exp) {
556+
console.warn('Gleap: Failed to capture screenshot', exp);
557+
resolve(null);
558+
}
552559
});
553560
};

0 commit comments

Comments
 (0)