1
- import * as SentryNode from '@sentry/node ' ;
1
+ import { captureException , getClient , getCurrentScope } from '@sentry/core ' ;
2
2
// eslint-disable-next-line import/no-extraneous-dependencies
3
3
import { H3Error } from 'h3' ;
4
4
import type { CapturedErrorContext } from 'nitropack' ;
@@ -8,7 +8,7 @@ import { extractErrorContext, flushIfServerless } from '../utils';
8
8
* Hook that can be added in a Nitro plugin. It captures an error and sends it to Sentry.
9
9
*/
10
10
export async function sentryCaptureErrorHook ( error : Error , errorContext : CapturedErrorContext ) : Promise < void > {
11
- const sentryClient = SentryNode . getClient ( ) ;
11
+ const sentryClient = getClient ( ) ;
12
12
const sentryClientOptions = sentryClient ?. getOptions ( ) ;
13
13
14
14
if (
@@ -33,12 +33,12 @@ export async function sentryCaptureErrorHook(error: Error, errorContext: Capture
33
33
} ;
34
34
35
35
if ( path ) {
36
- SentryNode . getCurrentScope ( ) . setTransactionName ( `${ method } ${ path } ` ) ;
36
+ getCurrentScope ( ) . setTransactionName ( `${ method } ${ path } ` ) ;
37
37
}
38
38
39
39
const structuredContext = extractErrorContext ( errorContext ) ;
40
40
41
- SentryNode . captureException ( error , {
41
+ captureException ( error , {
42
42
captureContext : { contexts : { nuxt : structuredContext } } ,
43
43
mechanism : { handled : false } ,
44
44
} ) ;
0 commit comments