Skip to content

Commit 3561347

Browse files
committed
Address review comments.
1 parent 546b07d commit 3561347

File tree

2 files changed

+27
-17
lines changed

2 files changed

+27
-17
lines changed

packages/node/src/integrations/hapi/index.ts

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
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';
29
import type { Integration } from '@sentry/types';
3-
import { addExceptionMechanism, dynamicSamplingContextToSentryBaggageHeader, fill } from '@sentry/utils';
10+
import { dynamicSamplingContextToSentryBaggageHeader, fill } from '@sentry/utils';
411

512
import type { Boom, RequestEvent, ResponseObject, Server } from './types';
613

@@ -17,25 +24,20 @@ function isErrorEvent(event: RequestEvent): event is RequestEvent {
1724
}
1825

1926
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+
},
3335
});
3436
}
3537

3638
export const hapiErrorPlugin = {
3739
name: 'SentryHapiErrorPlugin',
38-
version: '0.0.1',
40+
version: SDK_VERSION,
3941
register: async function (serverArg: Record<any, any>) {
4042
const server = serverArg as unknown as Server;
4143

@@ -58,7 +60,7 @@ export const hapiErrorPlugin = {
5860

5961
export const hapiTracingPlugin = {
6062
name: 'SentryHapiTracingPlugin',
61-
version: '0.0.1',
63+
version: SDK_VERSION,
6264
register: async function (serverArg: Record<any, any>) {
6365
const server = serverArg as unknown as Server;
6466

packages/node/src/integrations/hapi/types.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,16 @@
66

77
// Vendored and simplified from:
88
// - @types/hapi__hapi
9+
// v17.8.9999
10+
// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/c73060bd14bb74a2f1906ccfc714d385863bc07d/types/hapi/v17/index.d.ts
11+
//
912
// - @types/podium
13+
// v1.0.9999
14+
// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/c73060bd14bb74a2f1906ccfc714d385863bc07d/types/podium/index.d.ts
15+
//
1016
// - @types/boom
17+
// v7.3.9999
18+
// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/c73060bd14bb74a2f1906ccfc714d385863bc07d/types/boom/v4/index.d.ts
1119

1220
import type * as stream from 'stream';
1321
import type * as url from 'url';

0 commit comments

Comments
 (0)