Skip to content

Commit 64ab138

Browse files
authored
fix(flutter-web): hide unactionable missing source context errors (#62998)
Fixes getsentry/sentry-dart#1764
1 parent db0a376 commit 64ab138

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

static/app/components/events/interfaces/crashContent/exception/actionableItems.spec.tsx

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {ProjectFixture} from 'sentry-fixture/project';
55
import {render, screen} from 'sentry-test/reactTestingLibrary';
66

77
import {ActionableItems} from 'sentry/components/events/interfaces/crashContent/exception/actionableItems';
8+
import {JavascriptProcessingErrors} from 'sentry/constants/eventErrors';
89
import {EntryType} from 'sentry/types';
910

1011
describe('Actionable Items', () => {
@@ -115,6 +116,58 @@ describe('Actionable Items', () => {
115116
expect(await screen.findByText('Expand')).toBeInTheDocument();
116117
});
117118

119+
it('does not render hidden flutter web errors', async () => {
120+
const eventErrors = [
121+
{
122+
type: JavascriptProcessingErrors.JS_MISSING_SOURCES_CONTENT,
123+
data: {
124+
Source: "my_app/main.dart",
125+
},
126+
},
127+
{
128+
type: JavascriptProcessingErrors.JS_MISSING_SOURCES_CONTENT,
129+
data: {
130+
Source: "http://localhost:64053/Documents/flutter/packages/flutter/lib/src/material/ink_well.dart",
131+
},
132+
},
133+
{
134+
type: JavascriptProcessingErrors.JS_MISSING_SOURCES_CONTENT,
135+
data: {
136+
Source: "org-dartlang-sdk:///dart-sdk/lib/_internal/js_runtime/lib/async_patch.dart",
137+
},
138+
},
139+
{
140+
type: JavascriptProcessingErrors.JS_MISSING_SOURCES_CONTENT,
141+
data: {
142+
Source:
143+
"org-dartlang-sdk:///dart-sdk/lib/_internal/js_runtime/lib/js_helper.dart",
144+
},
145+
},
146+
];
147+
148+
MockApiClient.addMockResponse({
149+
url,
150+
body: {
151+
errors: eventErrors,
152+
},
153+
method: 'GET',
154+
});
155+
156+
const eventWithErrors = EventFixture({
157+
errors: eventErrors,
158+
sdk: {
159+
name: 'sentry.dart.flutter',
160+
},
161+
});
162+
163+
render(<ActionableItems {...defaultProps} event={eventWithErrors} />);
164+
165+
expect(
166+
await screen.findByText('Missing Sources Context (1)')
167+
).toBeInTheDocument();
168+
expect(await screen.findByText('Expand')).toBeInTheDocument();
169+
});
170+
118171
it('displays missing mapping file', async () => {
119172
const eventError = [
120173
{

static/app/components/events/interfaces/crashContent/exception/actionableItemsUtils.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,13 @@ export function shouldErrorBeShown(error: EventErrorData, event: Event) {
128128
// The Cocoa SDK sends wrong values for contexts.trace.sampled before 8.7.4
129129
return false;
130130
}
131+
// Hide unactionable source context errors that happen in flutter web: https://github.com/getsentry/sentry-dart/issues/1764
132+
if (event.sdk?.name === "sentry.dart.flutter" && error.type === JavascriptProcessingErrors.JS_MISSING_SOURCES_CONTENT) {
133+
const source = error.data?.Source;
134+
if (source.includes("org-dartlang-sdk:///dart-sdk/lib/_internal") || source.includes("flutter/packages/flutter/lib")) {
135+
return false;
136+
}
137+
}
131138
return true;
132139
}
133140

0 commit comments

Comments
 (0)