Skip to content

Commit ca90331

Browse files
authored
fix(replay): Add errorHandler for replayCanvas integration (#10796)
`errorHandler` for `CanvasManager` was added in the latest rrweb, but was not configured in our integration.
1 parent 65d9150 commit ca90331

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

packages/replay-canvas/src/canvas.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,20 @@ export const _replayCanvasIntegration = ((options: Partial<ReplayCanvasOptions>
7373
enableManualSnapshot,
7474
recordCanvas: true,
7575
getCanvasManager: (options: CanvasManagerOptions) => {
76-
const manager = new CanvasManager({ ...options, enableManualSnapshot });
76+
const manager = new CanvasManager({
77+
...options,
78+
enableManualSnapshot,
79+
errorHandler: (err: unknown) => {
80+
try {
81+
if (typeof err === 'object') {
82+
(err as Error & { __rrweb__?: boolean }).__rrweb__ = true;
83+
}
84+
} catch (error) {
85+
// ignore errors here
86+
// this can happen if the error is frozen or does not allow mutation for other reasons
87+
}
88+
},
89+
});
7790
canvasManagerResolve(manager);
7891
return manager;
7992
},

0 commit comments

Comments
 (0)