Skip to content

Commit 94575ac

Browse files
committed
Fix unhandled rejection error
e.g. when a service is not running
1 parent db9caf7 commit 94575ac

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

index.mjs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,15 @@ async function main() {
6969
};
7070
const response = await user.contribute(contribution);
7171
console.log(response);
72+
process.exit(0);
7273
}
74+
process.exit(-1);
7375
}
7476

75-
main();
77+
main().catch((err) => {
78+
console.log(err);
79+
if (err.code === 'ECONNREFUSED'){
80+
console.log('\nProbably a service is not running?\n');
81+
}
82+
process.exit(-100);
83+
});

0 commit comments

Comments
 (0)