From 68c3f61705d56e844baff54158d049abe0d7fe10 Mon Sep 17 00:00:00 2001 From: Jackson Huang Date: Wed, 5 Jun 2024 17:40:33 -0700 Subject: [PATCH 1/4] fix(rrweb): Catch and tag external errors for InsertRule & DeleteRule --- packages/rrweb/src/record/observer.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/rrweb/src/record/observer.ts b/packages/rrweb/src/record/observer.ts index 327c851d11..54753f8d5c 100644 --- a/packages/rrweb/src/record/observer.ts +++ b/packages/rrweb/src/record/observer.ts @@ -665,7 +665,12 @@ function initStyleSheetObserver( adds: [{ rule, index }], }); } - return target.apply(thisArg, argumentsList); + try { + return target.apply(thisArg, argumentsList); + } catch (error) { + (error as Error & {_external_?:boolean})._external_ = true; + throw error; + } }, ), }); @@ -694,7 +699,12 @@ function initStyleSheetObserver( removes: [{ index }], }); } - return target.apply(thisArg, argumentsList); + try { + return target.apply(thisArg, argumentsList); + } catch (error) { + (error as Error & {_external_?:boolean})._external_ = true; + throw error; + } }, ), }); From ead9a5b521a32022d715a5fb79b7f8e3c30b9e2b Mon Sep 17 00:00:00 2001 From: jackson-amplitude Date: Thu, 6 Jun 2024 00:49:29 +0000 Subject: [PATCH 2/4] Apply formatting changes --- packages/rrweb/src/record/observer.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/rrweb/src/record/observer.ts b/packages/rrweb/src/record/observer.ts index 54753f8d5c..d99b6b64ce 100644 --- a/packages/rrweb/src/record/observer.ts +++ b/packages/rrweb/src/record/observer.ts @@ -668,7 +668,7 @@ function initStyleSheetObserver( try { return target.apply(thisArg, argumentsList); } catch (error) { - (error as Error & {_external_?:boolean})._external_ = true; + (error as Error & { _external_?: boolean })._external_ = true; throw error; } }, @@ -702,7 +702,7 @@ function initStyleSheetObserver( try { return target.apply(thisArg, argumentsList); } catch (error) { - (error as Error & {_external_?:boolean})._external_ = true; + (error as Error & { _external_?: boolean })._external_ = true; throw error; } }, From 0dc3da8c90b8c1dcccff296a92ce38aa37aebceb Mon Sep 17 00:00:00 2001 From: Jackson Huang <94439126+jackson-amplitude@users.noreply.github.com> Date: Wed, 5 Jun 2024 17:57:31 -0700 Subject: [PATCH 3/4] Create long-bees-drop.md --- .changeset/long-bees-drop.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/long-bees-drop.md diff --git a/.changeset/long-bees-drop.md b/.changeset/long-bees-drop.md new file mode 100644 index 0000000000..72a0e4b232 --- /dev/null +++ b/.changeset/long-bees-drop.md @@ -0,0 +1,5 @@ +--- +"@amplitude/rrweb": patch +--- + +External error From ea80052b8dd7417c10559339b773a91342fea48f Mon Sep 17 00:00:00 2001 From: jackson-amplitude Date: Thu, 6 Jun 2024 00:58:32 +0000 Subject: [PATCH 4/4] Apply formatting changes --- .changeset/long-bees-drop.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/long-bees-drop.md b/.changeset/long-bees-drop.md index 72a0e4b232..3b2e582074 100644 --- a/.changeset/long-bees-drop.md +++ b/.changeset/long-bees-drop.md @@ -1,5 +1,5 @@ --- -"@amplitude/rrweb": patch +'@amplitude/rrweb': patch --- External error