File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
packages/nextjs/src/utils Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 1
1
import { captureException , flush , Handlers , withScope } from '@sentry/node' ;
2
2
import { addExceptionMechanism } from '@sentry/utils' ;
3
- import { NextApiRequest , NextApiResponse } from 'next' ;
3
+ import { NextApiHandler } from 'next' ;
4
4
5
5
const { parseRequest } = Handlers ;
6
6
7
+ // purely for clarity
8
+ type WrappedNextApiHandler = NextApiHandler ;
9
+
7
10
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
8
- export const withSentry = ( handler : ( req : NextApiRequest , res : NextApiResponse ) => Promise < void > ) => {
11
+ export const withSentry = ( handler : NextApiHandler ) : WrappedNextApiHandler => {
9
12
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
10
- return async ( req : NextApiRequest , res : NextApiResponse ) => {
13
+ return async ( req , res ) => {
11
14
try {
12
15
// TODO: Start Transaction
13
16
return await handler ( req , res ) ; // Call Handler
You can’t perform that action at this time.
0 commit comments