Skip to content

Commit

Permalink
fix: exit on uncaught exception
Browse files Browse the repository at this point in the history
  • Loading branch information
Battlesquid committed Jul 22, 2024
1 parent e942dfd commit 18f58de
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,12 @@ const cleanup = () => {
container.pool.end();
};

main().catch((error) => {
container.logger.error(error);
});
main();

process.on("uncaughtException", (error) => {
console.error(error);
cleanup();
process.exit(1);
});

process.on("SIGTERM", () => {
Expand Down
2 changes: 1 addition & 1 deletion src/listeners/imageboard_check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class ImageboardCheckListener extends Listener {
const notWhitelisted = !roles?.hasAny(...settings.whitelist);

if (locked && hasNoLink && hasNoAttachments && notWhitelisted) {
msg.delete();
ttry(() => msg.delete());
}
}
}

0 comments on commit 18f58de

Please sign in to comment.