From 58504e7d77465baaec5e10d43156b49a18674669 Mon Sep 17 00:00:00 2001 From: Yanzhen Yu Date: Wed, 1 Apr 2026 12:00:00 +0800 Subject: [PATCH] close #350 catch error may caused by checkout feature --- src/replay/index.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/replay/index.ts b/src/replay/index.ts index 6a691faf..442cae18 100644 --- a/src/replay/index.ts +++ b/src/replay/index.ts @@ -977,10 +977,19 @@ export class Replayer { for (const attributeName in mutation.attributes) { if (typeof attributeName === 'string') { const value = mutation.attributes[attributeName]; - if (value !== null) { - ((target as Node) as Element).setAttribute(attributeName, value); - } else { - ((target as Node) as Element).removeAttribute(attributeName); + try { + if (value !== null) { + ((target as Node) as Element).setAttribute(attributeName, value); + } else { + ((target as Node) as Element).removeAttribute(attributeName); + } + } catch (error) { + if (this.config.showWarning) { + console.warn( + 'An error occurred may due to the checkout feature.', + error, + ); + } } } }