From 4dcdcf7ec448758a9f7e49df4a8e1d8e46f5ca43 Mon Sep 17 00:00:00 2001 From: Ben White Date: Mon, 15 May 2023 14:19:42 +0200 Subject: [PATCH] fix: Rrror parser throw (#1225) * Warn instead of throwing error when parsing for console logs * Added error to warning --- .../rrweb/src/plugins/console/record/error-stack-parser.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/rrweb/src/plugins/console/record/error-stack-parser.ts b/packages/rrweb/src/plugins/console/record/error-stack-parser.ts index 4c0e49c3..b3448793 100644 --- a/packages/rrweb/src/plugins/console/record/error-stack-parser.ts +++ b/packages/rrweb/src/plugins/console/record/error-stack-parser.ts @@ -71,7 +71,11 @@ export const ErrorStackParser = { } else if (error.stack) { return this.parseFFOrSafari(error as { stack: string }); } else { - throw new Error('Cannot parse given Error object'); + console.warn( + '[console-record-plugin]: Failed to parse error object:', + error, + ); + return []; } }, // Separate line and column numbers from a string of the form: (URI:Line:Column)