@@ -8,13 +8,11 @@ export class RouterProxy {
88 targetCallback : RouterProxyCallback ,
99 exceptionsHandler : ExceptionsHandler ,
1010 ) {
11- return ( req , res , next ) => {
12- const host = new ExecutionContextHost ( [ req , res ] ) ;
11+ return async ( req , res , next ) => {
1312 try {
14- Promise . resolve ( targetCallback ( req , res , next ) ) . catch ( e => {
15- exceptionsHandler . next ( e , host ) ;
16- } ) ;
13+ await targetCallback ( req , res , next ) ;
1714 } catch ( e ) {
15+ const host = new ExecutionContextHost ( [ req , res ] ) ;
1816 exceptionsHandler . next ( e , host ) ;
1917 }
2018 } ;
@@ -24,13 +22,11 @@ export class RouterProxy {
2422 targetCallback : ( err , req , res , next ) => void ,
2523 exceptionsHandler : ExceptionsHandler ,
2624 ) {
27- return ( err , req , res , next ) => {
28- const host = new ExecutionContextHost ( [ req , res ] ) ;
25+ return async ( err , req , res , next ) => {
2926 try {
30- Promise . resolve ( targetCallback ( err , req , res , next ) ) . catch ( e => {
31- exceptionsHandler . next ( e , host ) ;
32- } ) ;
27+ await targetCallback ( err , req , res , next ) ;
3328 } catch ( e ) {
29+ const host = new ExecutionContextHost ( [ req , res ] ) ;
3430 exceptionsHandler . next ( e , host ) ;
3531 }
3632 } ;
0 commit comments