feat(api): 🧑‍💻 Improve error quality with Youch

This commit is contained in:
Jesse Wierzbinski 2025-03-27 19:08:38 +01:00
parent 58b4d7454f
commit 1993231663
No known key found for this signature in database
4 changed files with 37 additions and 5 deletions

View file

@ -1,6 +1,7 @@
import cluster from "node:cluster";
import { sentry } from "@/sentry";
import { createServer } from "@/server";
import { Youch } from "youch";
import { appFactory } from "~/app";
import { config } from "~/config.ts";
@ -8,6 +9,12 @@ process.on("SIGINT", () => {
process.exit();
});
process.on("uncaughtException", async (error) => {
const youch = new Youch();
console.error(await youch.toANSI(error));
});
if (cluster.isPrimary) {
for (let i = 0; i < Number(process.env.NUM_CPUS ?? 1); i++) {
cluster.fork();