@lvchengbin/yolk
Advanced tools
Comparing version 0.0.18 to 0.0.19
@@ -58,2 +58,4 @@ const fs = require( 'fs' ); | ||
this.console = new Console( this, 'module' ); | ||
this.ready( () => { | ||
@@ -71,4 +73,2 @@ this.console.log( `module ${this.moduleName} is ready.` ); | ||
this.console = new Console( this, 'module' ); | ||
// do init config before initializing other parts. | ||
@@ -75,0 +75,0 @@ this.console.log( '>>> start to load config files.' ) ; |
@@ -52,3 +52,8 @@ const request = require( 'request-promise-native' ); | ||
if( !conf ) { | ||
this.console.error( `cannot find service "${service}" in config files.` ); | ||
const msg = `cannot find service "${service}" in config files.`; | ||
this.console.error( msg ); | ||
this.module.logger.error( msg, { | ||
module : this.module.moduleName | ||
} ); | ||
throw new Error( msg ); | ||
} | ||
@@ -77,3 +82,13 @@ uri = `${conf.protocol}://${conf.host}/${path}`; | ||
return request( options ); | ||
return request( options ).then( res => { | ||
this.console.info( 'got response from remote service', res ); | ||
return res; | ||
} ).catch( e => { | ||
this.console.error( 'failed to call remove service' ); | ||
this.module.logger.error( 'failed to call remove service', { | ||
module : this.module.moduleName, | ||
error : e, | ||
options | ||
} ); | ||
} ); | ||
} | ||
@@ -148,3 +163,3 @@ | ||
} | ||
next(); | ||
return next(); | ||
}; | ||
@@ -151,0 +166,0 @@ } |
@@ -8,3 +8,3 @@ { | ||
}, | ||
"version": "0.0.18", | ||
"version": "0.0.19", | ||
"keywords": [ | ||
@@ -11,0 +11,0 @@ "koa", |
37528
988