1
- import { captureException , configureScope , continueTrace , getActiveTransaction , startTransaction } from '@sentry/core' ;
1
+ import {
2
+ captureException ,
3
+ configureScope ,
4
+ continueTrace ,
5
+ getActiveTransaction ,
6
+ SDK_VERSION ,
7
+ startTransaction ,
8
+ } from '@sentry/core' ;
2
9
import type { Integration } from '@sentry/types' ;
3
- import { addExceptionMechanism , dynamicSamplingContextToSentryBaggageHeader , fill } from '@sentry/utils' ;
10
+ import { dynamicSamplingContextToSentryBaggageHeader , fill } from '@sentry/utils' ;
4
11
5
12
import type { Boom , RequestEvent , ResponseObject , Server } from './types' ;
6
13
@@ -17,25 +24,20 @@ function isErrorEvent(event: RequestEvent): event is RequestEvent {
17
24
}
18
25
19
26
function sendErrorToSentry ( errorData : object ) : void {
20
- captureException ( errorData , scope => {
21
- scope . addEventProcessor ( event => {
22
- addExceptionMechanism ( event , {
23
- type : 'hapi' ,
24
- handled : false ,
25
- data : {
26
- function : 'hapiErrorPlugin' ,
27
- } ,
28
- } ) ;
29
- return event ;
30
- } ) ;
31
-
32
- return scope ;
27
+ captureException ( errorData , {
28
+ mechanism : {
29
+ type : 'hapi' ,
30
+ handled : false ,
31
+ data : {
32
+ function : 'hapiErrorPlugin' ,
33
+ } ,
34
+ } ,
33
35
} ) ;
34
36
}
35
37
36
38
export const hapiErrorPlugin = {
37
39
name : 'SentryHapiErrorPlugin' ,
38
- version : '0.0.1' ,
40
+ version : SDK_VERSION ,
39
41
register : async function ( serverArg : Record < any , any > ) {
40
42
const server = serverArg as unknown as Server ;
41
43
@@ -58,7 +60,7 @@ export const hapiErrorPlugin = {
58
60
59
61
export const hapiTracingPlugin = {
60
62
name : 'SentryHapiTracingPlugin' ,
61
- version : '0.0.1' ,
63
+ version : SDK_VERSION ,
62
64
register : async function ( serverArg : Record < any , any > ) {
63
65
const server = serverArg as unknown as Server ;
64
66
0 commit comments