Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(replay): Add errorHandler for replayCanvas integration #10796

Merged
merged 3 commits into from Feb 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 14 additions & 1 deletion packages/replay-canvas/src/canvas.ts
Expand Up @@ -73,7 +73,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