Skip to content

Commit

Permalink
✨ add anti process exit
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoineKM committed Aug 18, 2023
1 parent 85b2e03 commit b778b55
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/yellow-queens-chew.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"dixt": patch
---

Add anti process exit
13 changes: 13 additions & 0 deletions packages/dixt/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import dotenv from "dotenv-flow";
import EventEmiter from "events";
import { merge } from "lodash";
import mongoose, { Mongoose } from "mongoose";
import process from "process";

import { DixtClient, DixtSlashCommandBuilder } from "./types";
import Log from "./utils/log";
Expand Down Expand Up @@ -135,6 +136,18 @@ class dixt {
}
}

process.on("unhandledRejection", async (reason, promise) => {
Log.error("unhandled promise rejection", promise, "reason:", reason);
});

process.on("uncaughtException", async (error) => {
Log.error("uncaught exception", error);
});

process.on("uncaughtExceptionMonitor", async (error, origin) => {
Log.error("uncaught exception monitor", error, "origin:", origin);
});

export { merge };
export { default as capitalize } from "./utils/capitalize";
export * from "./utils/discord";
Expand Down

0 comments on commit b778b55

Please sign in to comment.