Skip to content

Commit 7954e55

Browse files
committed
Use react_router.rsc mechanism type for RSC error capture
1 parent 4dd9b7f commit 7954e55

File tree

7 files changed

+8
-10
lines changed

7 files changed

+8
-10
lines changed

dev-packages/e2e-tests/test-applications/react-router-7-rsc/tests/rsc/server-component.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ test.describe('RSC - Server Component Wrapper', () => {
2121
value: errorMessage,
2222
mechanism: {
2323
handled: false,
24-
type: 'instrument',
24+
type: 'react_router.rsc',
2525
data: {
2626
function: 'ServerComponent',
2727
component_route: '/rsc/server-component-error',

dev-packages/e2e-tests/test-applications/react-router-7-rsc/tests/rsc/server-function.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ test.describe('RSC - Server Function Wrapper', () => {
9595
value: errorMessage,
9696
mechanism: {
9797
handled: false,
98-
type: 'instrument',
98+
type: 'react_router.rsc',
9999
data: {
100100
function: 'serverFunction',
101101
server_function_name: 'submitFormWithError',

packages/react-router/src/server/rsc/wrapServerComponent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ function handleError(error: unknown, componentRoute: string, componentType: stri
104104
if (!isAlreadyCaptured(error)) {
105105
captureException(error, {
106106
mechanism: {
107-
type: 'instrument',
107+
type: 'react_router.rsc',
108108
handled: false,
109109
data: {
110110
function: 'ServerComponent',

packages/react-router/src/server/rsc/wrapServerFunction.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export function wrapServerFunction<T extends (...args: any[]) => Promise<any>>(
8585
if (!isAlreadyCaptured(error)) {
8686
captureException(error, {
8787
mechanism: {
88-
type: 'instrument',
88+
type: 'react_router.rsc',
8989
handled: false,
9090
data: {
9191
function: 'serverFunction',

packages/react-router/src/vite/makeAutoInstrumentRSCPlugin.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,7 @@ function collectNamedExports(node: BabelExportNamedDeclaration, into: Set<string
109109

110110
if (node.specifiers) {
111111
node.specifiers
112-
.filter(
113-
spec => spec.type === 'ExportSpecifier' && (spec as BabelExportSpecifier).exportKind !== 'type',
114-
)
112+
.filter(spec => spec.type === 'ExportSpecifier' && (spec as BabelExportSpecifier).exportKind !== 'type')
115113
.forEach(spec => {
116114
const name = getExportedName(spec.exported as t.Identifier | t.StringLiteral);
117115
if (name === 'default') {

packages/react-router/test/server/rsc/wrapServerComponent.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ describe('wrapServerComponent', () => {
6262
expect(mockSetStatus).toHaveBeenCalledWith({ code: core.SPAN_STATUS_ERROR, message: 'internal_error' });
6363
expect(core.captureException).toHaveBeenCalledWith(mockError, {
6464
mechanism: {
65-
type: 'instrument',
65+
type: 'react_router.rsc',
6666
handled: false,
6767
data: {
6868
function: 'ServerComponent',
@@ -94,7 +94,7 @@ describe('wrapServerComponent', () => {
9494

9595
expect(core.captureException).toHaveBeenCalledWith(mockError, {
9696
mechanism: {
97-
type: 'instrument',
97+
type: 'react_router.rsc',
9898
handled: false,
9999
data: {
100100
function: 'ServerComponent',

packages/react-router/test/server/rsc/wrapServerFunction.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ describe('wrapServerFunction', () => {
128128
expect(mockSetStatus).toHaveBeenCalledWith({ code: 2, message: 'internal_error' });
129129
expect(core.captureException).toHaveBeenCalledWith(mockError, {
130130
mechanism: {
131-
type: 'instrument',
131+
type: 'react_router.rsc',
132132
handled: false,
133133
data: {
134134
function: 'serverFunction',

0 commit comments

Comments
 (0)