From e3c0058942e81c55a62ae5f265bf0b653fcac65f Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 9 Apr 2019 23:29:48 +0900 Subject: [PATCH] Refactor --- src/init.ts | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/init.ts b/src/init.ts index 69c117c14..3dcfc28b7 100644 --- a/src/init.ts +++ b/src/init.ts @@ -1,16 +1,10 @@ import { initDb } from './db/postgre'; -async function main() { - try { - console.log('Connecting database...'); - await initDb(false, true, true); - } catch (e) { - console.error('Cannot connect to database', null, true); - console.error(e); - process.exit(1); - } +console.log('Init database...'); +initDb(false, true, true).then(() => { console.log('Done :)'); -} - -main(); +}, e => { + console.error('Failed to init database'); + console.error(e); +});