Skip to content

Commit 378d6d0

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

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

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

Lines changed: 17 additions & 5 deletions
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 { isUndefined, log, getErrorMessage } from '@guardian/libs';
44
import {
55
article17,
66
from,
@@ -223,11 +223,23 @@ const setupWindowListeners = (iframe: HTMLIFrameElement) => {
223223
try {
224224
message = JSON.parse(event.data);
225225
} catch (e) {
226-
window.guardian.modules.sentry.reportError(
226+
if (
227227
// @ts-expect-error
228-
e,
229-
'Json parse Failed on in interactiveBlockComponent',
230-
);
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+
}
231243
}
232244

233245
if (isUndefined(message)) {

0 commit comments

Comments
 (0)