File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed
dev-packages/node-integration-tests/suites/tracing-experimental/hapi Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ Sentry.init({
99} ) ;
1010
1111const Hapi = require ( '@hapi/hapi' ) ;
12+ const Boom = require ( '@hapi/boom' ) ;
1213
1314const 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
Original file line number Diff line number Diff 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} ) ;
You can’t perform that action at this time.
0 commit comments