Skip to content

Commit 23514b7

Browse files
committed
Move data inside mechanism object
1 parent e3064e2 commit 23514b7

File tree

4 files changed

+13
-20
lines changed

4 files changed

+13
-20
lines changed

packages/react-router/src/common/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,15 @@ export function captureInstrumentationError(
5050
result: InstrumentationResult,
5151
captureErrors: boolean,
5252
mechanismType: string,
53-
data: Record<string, unknown>,
53+
data: Record<string, string | boolean>,
5454
): void {
5555
if (result.status === 'error' && captureErrors && isError(result.error)) {
5656
captureException(result.error, {
5757
mechanism: {
5858
type: mechanismType,
5959
handled: false,
60+
data,
6061
},
61-
data,
6262
});
6363
}
6464
}

packages/react-router/test/client/createClientInstrumentation.test.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -214,10 +214,7 @@ describe('createSentryClientInstrumentation', () => {
214214
});
215215

216216
expect(core.captureException).toHaveBeenCalledWith(mockError, {
217-
mechanism: { type: 'react_router.client_loader', handled: false },
218-
data: {
219-
'http.url': '/test-path',
220-
},
217+
mechanism: { type: 'react_router.client_loader', handled: false, data: { 'http.url': '/test-path' } },
221218
});
222219
});
223220

@@ -268,10 +265,7 @@ describe('createSentryClientInstrumentation', () => {
268265
});
269266

270267
expect(core.captureException).toHaveBeenCalledWith(mockError, {
271-
mechanism: { type: 'react_router.navigate', handled: false },
272-
data: {
273-
'http.url': '/about',
274-
},
268+
mechanism: { type: 'react_router.navigate', handled: false, data: { 'http.url': '/about' } },
275269
});
276270
});
277271

packages/react-router/test/common/utils.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,7 @@ describe('captureInstrumentationError', () => {
9494
captureInstrumentationError(result, true, 'react_router.loader', data);
9595

9696
expect(core.captureException).toHaveBeenCalledWith(error, {
97-
mechanism: { type: 'react_router.loader', handled: false },
98-
data,
97+
mechanism: { type: 'react_router.loader', handled: false, data },
9998
});
10099
});
101100

packages/react-router/test/server/createServerInstrumentation.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,10 @@ describe('createSentryServerInstrumentation', () => {
132132
await hooks.request(mockHandleRequest, { request: mockRequest, context: undefined });
133133

134134
expect(core.captureException).toHaveBeenCalledWith(mockError, {
135-
mechanism: { type: 'react_router.request_handler', handled: false },
136-
data: {
137-
'http.method': 'GET',
138-
'http.url': '/api/users',
135+
mechanism: {
136+
type: 'react_router.request_handler',
137+
handled: false,
138+
data: { 'http.method': 'GET', 'http.url': '/api/users' },
139139
},
140140
});
141141
});
@@ -367,10 +367,10 @@ describe('createSentryServerInstrumentation', () => {
367367
});
368368

369369
expect(core.captureException).toHaveBeenCalledWith(mockError, {
370-
mechanism: { type: 'react_router.loader', handled: false },
371-
data: {
372-
'http.method': 'GET',
373-
'http.url': '/test',
370+
mechanism: {
371+
type: 'react_router.loader',
372+
handled: false,
373+
data: { 'http.method': 'GET', 'http.url': '/test' },
374374
},
375375
});
376376
});

0 commit comments

Comments
 (0)