Skip to content

Commit 9b45cec

Browse files
committed
Update tests.
1 parent 93c3abb commit 9b45cec

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

dev-packages/node-integration-tests/suites/tracing-experimental/hapi/scenario.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Sentry.init({
99
});
1010

1111
const Hapi = require('@hapi/hapi');
12+
const Boom = require('@hapi/boom');
1213

1314
const port = 5999;
1415

@@ -30,7 +31,15 @@ const init = async () => {
3031
method: 'GET',
3132
path: '/error',
3233
handler: (_request, _h) => {
33-
throw new Error('Sentry Test Error');
34+
return new Error('Sentry Test Error');
35+
},
36+
});
37+
38+
server.route({
39+
method: 'GET',
40+
path: '/boom-error',
41+
handler: (_request, _h) => {
42+
return new Boom.Boom('Sentry Test Error');
3443
},
3544
});
3645

dev-packages/node-integration-tests/suites/tracing-experimental/hapi/test.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,19 @@ describe('hapi auto-instrumentation', () => {
4343
.makeRequest('get', '/');
4444
});
4545

46-
test('CJS - should handle errors in routes.', done => {
46+
test('CJS - should handle returned plain errors in routes.', done => {
4747
createRunner(__dirname, 'scenario.js')
4848
.expect({ event: EXPECTED_ERROR_EVENT })
4949
.expectError()
5050
.start(done)
5151
.makeRequest('get', '/error');
5252
});
53+
54+
test('CJS - should handle returned Boom errors in routes.', done => {
55+
createRunner(__dirname, 'scenario.js')
56+
.expect({ event: EXPECTED_ERROR_EVENT })
57+
.expectError()
58+
.start(done)
59+
.makeRequest('get', '/boom-error');
60+
});
5361
});

0 commit comments

Comments
 (0)