File tree 2 files changed +19
-2
lines changed
dev-packages/node-integration-tests/suites/tracing-experimental/hapi
2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ Sentry.init({
9
9
} ) ;
10
10
11
11
const Hapi = require ( '@hapi/hapi' ) ;
12
+ const Boom = require ( '@hapi/boom' ) ;
12
13
13
14
const port = 5999 ;
14
15
@@ -30,7 +31,15 @@ const init = async () => {
30
31
method : 'GET' ,
31
32
path : '/error' ,
32
33
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' ) ;
34
43
} ,
35
44
} ) ;
36
45
Original file line number Diff line number Diff line change @@ -43,11 +43,19 @@ describe('hapi auto-instrumentation', () => {
43
43
. makeRequest ( 'get' , '/' ) ;
44
44
} ) ;
45
45
46
- test ( 'CJS - should handle errors in routes.' , done => {
46
+ test ( 'CJS - should handle returned plain errors in routes.' , done => {
47
47
createRunner ( __dirname , 'scenario.js' )
48
48
. expect ( { event : EXPECTED_ERROR_EVENT } )
49
49
. expectError ( )
50
50
. start ( done )
51
51
. makeRequest ( 'get' , '/error' ) ;
52
52
} ) ;
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
+ } ) ;
53
61
} ) ;
You can’t perform that action at this time.
0 commit comments