Skip to content

Commit 2ed72c5

Browse files
committed
Log or report to Sentry, json parsing errors in InteractiveBlockComponent
1 parent b243dc5 commit 2ed72c5

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

dotcom-rendering/src/components/InteractiveBlockComponent.importable.tsx

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { css } from '@emotion/react';
22
import type { SerializedStyles } from '@emotion/react';
3-
import { isUndefined } from '@guardian/libs';
3+
import { getErrorMessage, isUndefined, log } from '@guardian/libs';
44
import {
55
article17,
66
from,
@@ -223,6 +223,23 @@ const setupWindowListeners = (iframe: HTMLIFrameElement) => {
223223
try {
224224
message = JSON.parse(event.data);
225225
} catch (e) {
226+
if (
227+
// @ts-expect-error
228+
window.guardian.config.page.contentId ===
229+
'politics/2025/oct/02/could-nigel-farage-really-win-the-next-election-heres-what-the-polls-say'
230+
) {
231+
log(
232+
'dotcom',
233+
getErrorMessage(e),
234+
'Json parse Failed on in interactiveBlockComponent',
235+
);
236+
} else {
237+
window.guardian.modules.sentry.reportError(
238+
// @ts-expect-error
239+
e,
240+
'Json parse Failed on in interactiveBlockComponent',
241+
);
242+
}
226243
window.guardian.modules.sentry.reportError(
227244
// @ts-expect-error
228245
e,

0 commit comments

Comments
 (0)