Skip to content

Commit 8b285b7

Browse files
authored
fix(issues): Move sentry attachment exception (#93783)
1 parent 05a5e9b commit 8b285b7

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

static/app/components/events/attachmentViewers/previewAttachmentTypes.tsx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import * as Sentry from '@sentry/react';
2-
31
import ImageViewer from 'sentry/components/events/attachmentViewers/imageViewer';
42
import JsonViewer from 'sentry/components/events/attachmentViewers/jsonViewer';
53
import LogFileViewer from 'sentry/components/events/attachmentViewers/logFileViewer';
@@ -61,12 +59,6 @@ export const getInlineAttachmentRenderer = (
6159
return WebMViewer;
6260
}
6361

64-
Sentry.withScope(scope => {
65-
scope.setExtra('mimetype', attachment.mimetype);
66-
scope.setExtra('attachmentName', attachment.name);
67-
scope.setFingerprint(['no-inline-attachment-renderer']);
68-
scope.captureException(new Error('No inline attachment renderer found'));
69-
});
7062
return undefined;
7163
};
7264

static/app/components/events/eventTagsAndScreenshot/screenshot/modal.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import type {ComponentProps} from 'react';
2-
import {Fragment, useCallback, useMemo, useState} from 'react';
2+
import {Fragment, useCallback, useEffect, useMemo, useState} from 'react';
33
import {css} from '@emotion/react';
44
import styled from '@emotion/styled';
5+
import * as Sentry from '@sentry/react';
56

67
import type {ModalRenderProps} from 'sentry/actionCreators/modal';
78
import Confirm from 'sentry/components/confirm';
@@ -107,6 +108,17 @@ export default function ScreenshotModal({
107108

108109
const AttachmentComponent = getInlineAttachmentRenderer(currentEventAttachment)!;
109110

111+
useEffect(() => {
112+
if (currentEventAttachment && !AttachmentComponent) {
113+
Sentry.withScope(scope => {
114+
scope.setExtra('mimetype', currentEventAttachment.mimetype);
115+
scope.setExtra('attachmentName', currentEventAttachment.name);
116+
scope.setFingerprint(['no-inline-attachment-renderer']);
117+
scope.captureException(new Error('No screenshot attachment renderer found'));
118+
});
119+
}
120+
}, [currentEventAttachment, AttachmentComponent]);
121+
110122
return (
111123
<Fragment>
112124
<Header closeButton>

0 commit comments

Comments
 (0)