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 {
328
328
const middlewareFunctions : Function [ ] = [ ] ;
329
329
uses . forEach ( use => {
330
330
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 > ) => {
332
332
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 ) ;
347
334
} catch ( error ) {
348
- this . handleError ( error , undefined , {
335
+ return await this . handleError ( error , undefined , {
349
336
request : context . request ,
350
337
response : context . response ,
351
338
context,
@@ -423,4 +410,4 @@ export class KoaDriver extends BaseDriver {
423
410
424
411
return await next ( ) ;
425
412
}
426
- }
413
+ }
You can’t perform that action at this time.
0 commit comments