Skip to content
This repository has been archived by the owner on Mar 3, 2022. It is now read-only.

Commit

Permalink
feat: kill process when init fails
Browse files Browse the repository at this point in the history
  • Loading branch information
nytamin committed Jul 3, 2018
1 parent 538f144 commit fe05191
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/connector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class Connector {
this._logger = logger
}

init (config: Config): Promise<number> {
init (config: Config): Promise<void> {
this._config = config

return Promise.resolve()
Expand All @@ -37,13 +37,26 @@ export class Connector {
})
.then(() => {
this._logger.info('Initialization done')
return 0
return
})
.catch((e) => {
this._logger.error('Error during initialization:', e, e.stack)
// this._logger.error(e)
// this._logger.error(e.stack)
return 0

try {
this.dispose()
.catch(e => this._logger.error(e))
} catch (e) {
this._logger.error(e)
}

this._logger.info('Shutting down in 10 seconds!')
setTimeout(() => {
process.exit(0)
}, 10 * 1000)

return
})
}
initCore () {
Expand Down

0 comments on commit fe05191

Please sign in to comment.