From 1f83d88a6ad6a4fa0c361425ff713f9ebabe84b5 Mon Sep 17 00:00:00 2001 From: Sameh Abouel-saad Date: Fri, 7 Jun 2024 04:13:47 +0300 Subject: [PATCH] fix: fix init-countries --- scripts/init-countries.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/init-countries.js b/scripts/init-countries.js index d680000..48c4adb 100644 --- a/scripts/init-countries.js +++ b/scripts/init-countries.js @@ -25,16 +25,18 @@ async function main () { try { countries = await getCountries() } catch (error) { + console.log(error) console.log('--- No Countries were found, a restart is suggested ---') - process.exit(0) + process.exit(-3) } let cities = [] try { cities = await getCities() } catch (error) { + console.log(error) console.log('--- No Cities were found, a restart is suggested ---') - process.exit(0) + process.exit(-2) } const pool = new Pool(config) @@ -102,12 +104,12 @@ async function main () { .then(res => { console.log(res) }) - .catch(err => console.log(err)) + .catch(err => { console.log(err); process.exit(1)}) .then(process.exit(0)) } catch (error) { console.log(error) - process.exit(0) + process.exit(2) } }