Skip to content

Commit

Permalink
Handle uncaughtException (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
u1-liquid authored Jan 24, 2024
1 parent e676927 commit 06c34b3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// AiOS bootstrapper

import process from 'node:process';
import chalk from 'chalk';
import got from 'got';
import promiseRetry from 'promise-retry';
Expand Down Expand Up @@ -45,6 +46,13 @@ function log(msg: string): void {

log(chalk.bold(`Ai v${pkg._v}`));

process.on('uncaughtException', err => {
try {
console.error(`Uncaught exception: ${err.message}`);
console.dir(err, { colors: true, depth: 2 });
} catch { }
});

promiseRetry(retry => {
log(`Account fetching... ${chalk.gray(config.host)}`);

Expand Down

0 comments on commit 06c34b3

Please sign in to comment.