Skip to content

Commit

Permalink
fix(replay): Add errorHandler for replayCanvas integration (#10796)
Browse files Browse the repository at this point in the history
`errorHandler` for `CanvasManager` was added in the latest rrweb, but
was not configured in our integration.
  • Loading branch information
billyvg authored and AbhiPrasad committed Feb 29, 2024
1 parent c9e8fa9 commit 3770187
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion packages/replay-canvas/src/canvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,20 @@ export const _replayCanvasIntegration = ((options: Partial<ReplayCanvasOptions>
enableManualSnapshot,
recordCanvas: true,
getCanvasManager: (options: CanvasManagerOptions) => {
const manager = new CanvasManager({ ...options, enableManualSnapshot });
const manager = new CanvasManager({
...options,
enableManualSnapshot,
errorHandler: (err: unknown) => {
try {
if (typeof err === 'object') {
(err as Error & { __rrweb__?: boolean }).__rrweb__ = true;
}
} catch (error) {
// ignore errors here
// this can happen if the error is frozen or does not allow mutation for other reasons
}
},
});
canvasManagerResolve(manager);
return manager;
},
Expand Down

0 comments on commit 3770187

Please sign in to comment.