File tree Expand file tree Collapse file tree 1 file changed +4
-17
lines changed Expand file tree Collapse file tree 1 file changed +4
-17
lines changed Original file line number Diff line number Diff line change @@ -328,24 +328,11 @@ export class KoaDriver extends BaseDriver {
328328 const middlewareFunctions : Function [ ] = [ ] ;
329329 uses . forEach ( use => {
330330 if ( use . middleware . prototype && use . middleware . prototype . use ) { // if this is function instance of MiddlewareInterface
331- middlewareFunctions . push ( ( context : any , next : ( err ?: any ) => Promise < any > ) => {
331+ middlewareFunctions . push ( async ( context : any , next : ( err ?: any ) => Promise < any > ) => {
332332 try {
333- const useResult = ( getFromContainer ( use . middleware ) as KoaMiddlewareInterface ) . use ( context , next ) ;
334- if ( isPromiseLike ( useResult ) ) {
335- useResult . catch ( ( error : any ) => {
336- this . handleError ( error , undefined , {
337- request : context . req ,
338- response : context . res ,
339- context,
340- next
341- } ) ;
342- return error ;
343- } ) ;
344- }
345-
346- return useResult ;
333+ return await ( getFromContainer ( use . middleware ) as KoaMiddlewareInterface ) . use ( context , next ) ;
347334 } catch ( error ) {
348- this . handleError ( error , undefined , {
335+ return await this . handleError ( error , undefined , {
349336 request : context . request ,
350337 response : context . response ,
351338 context,
@@ -423,4 +410,4 @@ export class KoaDriver extends BaseDriver {
423410
424411 return await next ( ) ;
425412 }
426- }
413+ }
You can’t perform that action at this time.
0 commit comments