Skip to content

Commit 93ebc28

Browse files
author
Luca Forstner
committed
Make wrapper name a little bit less annoying lol
1 parent 82fb3fa commit 93ebc28

File tree

3 files changed

+11
-23
lines changed

3 files changed

+11
-23
lines changed

packages/nextjs/src/config/wrappers/withSentryGetServerSideProps.ts

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { hasTracingEnabled } from '@sentry/tracing';
22
import { GetServerSideProps } from 'next';
33

4-
import { callServerSideDataFetcherWithTracingInstrumentation, withErrorInstrumentation } from './wrapperUtils';
4+
import { callTracedServerSideDataFetcher, withErrorInstrumentation } from './wrapperUtils';
55

66
/**
77
* Create a wrapped version of the user's exported `getServerSideProps` function
@@ -23,16 +23,10 @@ export function withSentryGetServerSideProps(
2323
const errorWrappedGetServerSideProps = withErrorInstrumentation(origGetServerSideProps);
2424

2525
if (hasTracingEnabled()) {
26-
return callServerSideDataFetcherWithTracingInstrumentation(
27-
errorWrappedGetServerSideProps,
28-
getServerSidePropsArguments,
29-
req,
30-
res,
31-
{
32-
parameterizedRoute,
33-
functionName: 'getServerSideProps',
34-
},
35-
);
26+
return callTracedServerSideDataFetcher(errorWrappedGetServerSideProps, getServerSidePropsArguments, req, res, {
27+
parameterizedRoute,
28+
functionName: 'getServerSideProps',
29+
});
3630
} else {
3731
return errorWrappedGetServerSideProps(...getServerSidePropsArguments);
3832
}

packages/nextjs/src/config/wrappers/withSentryServerSideGetInitialProps.ts

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { hasTracingEnabled } from '@sentry/tracing';
22
import { NextPage } from 'next';
33

4-
import { callServerSideDataFetcherWithTracingInstrumentation, withErrorInstrumentation } from './wrapperUtils';
4+
import { callTracedServerSideDataFetcher, withErrorInstrumentation } from './wrapperUtils';
55

66
type GetInitialProps = Required<NextPage>['getInitialProps'];
77

@@ -25,16 +25,10 @@ export function withSentryServerSideGetInitialProps(
2525
const errorWrappedGetInitialProps = withErrorInstrumentation(origGetInitialProps);
2626

2727
if (req && res && hasTracingEnabled()) {
28-
return callServerSideDataFetcherWithTracingInstrumentation(
29-
errorWrappedGetInitialProps,
30-
getInitialPropsArguments,
31-
req,
32-
res,
33-
{
34-
parameterizedRoute,
35-
functionName: 'getInitialProps',
36-
},
37-
);
28+
return callTracedServerSideDataFetcher(errorWrappedGetInitialProps, getInitialPropsArguments, req, res, {
29+
parameterizedRoute,
30+
functionName: 'getInitialProps',
31+
});
3832
} else {
3933
return errorWrappedGetInitialProps(...getInitialPropsArguments);
4034
}

packages/nextjs/src/config/wrappers/wrapperUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export function withErrorInstrumentation<F extends (...args: any[]) => any>(
5959
* @param options Options providing details for the created transaction and span.
6060
* @returns what the data fetching method call returned.
6161
*/
62-
export function callServerSideDataFetcherWithTracingInstrumentation<F extends (...args: any[]) => Promise<any> | any>(
62+
export function callTracedServerSideDataFetcher<F extends (...args: any[]) => Promise<any> | any>(
6363
origFunction: F,
6464
origFunctionArguments: Parameters<F>,
6565
req: IncomingMessage,

0 commit comments

Comments
 (0)