@@ -99,7 +99,7 @@ export class AppFactory {
9999 */
100100 public async setup ( ) {
101101 // Iterate list of module classes
102- return promiseSeries (
102+ const result = await promiseSeries (
103103 this . config . modules . map ( ( Module : Constructor ) => async ( ) => {
104104 //this.config.modules.forEach(async (Module: Constructor) => {
105105 console . log ( 'Module Name: ' , Module . name ) ;
@@ -129,13 +129,15 @@ export class AppFactory {
129129 this . app . modules [ Module . name ] ,
130130 Module ,
131131 ) ;
132- if ( process . send )
133- process . send ( {
134- type : OperationType . APP_CREATE_RESPONSE ,
135- message : this . schema ( ) ,
136- } ) ;
137132 } ) ,
138133 ) ;
134+ if ( process . send )
135+ process . send ( {
136+ type : OperationType . APP_CREATE_RESPONSE ,
137+ message : this . schema ( ) ,
138+ } ) ;
139+
140+ return result ;
139141 }
140142 /**
141143 * @method setupComponents
@@ -361,13 +363,17 @@ export class AppFactory {
361363 } ) ,
362364 ) ;
363365 }
364- // read file from file system
365- const data = await AsyncReadFile ( pathname ) ;
366- // Potentially get cookies and headers
367- const result = await instance [ method ] ( req , data ) ;
368- // Set response headers
369- res . setHeader ( 'Content-type' , map [ ext ] || 'text/plain' ) ;
370- res . end ( Utils . IsJsonString ( result ) ? JSON . stringify ( result ) : result ) ;
366+ try {
367+ // read file from file system
368+ const data = await AsyncReadFile ( pathname ) ;
369+ // Potentially get cookies and headers
370+ const result = await instance [ method ] ( req , data ) ;
371+ // Set response headers
372+ res . setHeader ( 'Content-type' , map [ ext ] || 'text/plain' ) ;
373+ res . end ( Utils . IsJsonString ( result ) ? JSON . stringify ( result ) : result ) ;
374+ } catch ( e ) {
375+ next ( ) ;
376+ }
371377 }
372378 }
373379 /**
0 commit comments