mirror of
https://github.com/sp-tarkov/server.git
synced 2025-02-13 09:50:43 -05:00
Removes the `IUUidGenerator` class in favour of the built-in `crypto.randomUUID()` method.
35 lines
1.1 KiB
TypeScript
35 lines
1.1 KiB
TypeScript
import readline from "node:readline";
|
|
|
|
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
|
|
import { AsyncQueue } from "@spt-aki/utils/AsyncQueue";
|
|
import { WinstonMainLogger } from "@spt-aki/utils/logging/WinstonMainLogger";
|
|
|
|
export class ErrorHandler
|
|
{
|
|
private logger: ILogger;
|
|
private readLine: readline.Interface;
|
|
|
|
constructor()
|
|
{
|
|
this.logger = new WinstonMainLogger(new AsyncQueue());
|
|
this.readLine = readline.createInterface({
|
|
input: process.stdin,
|
|
output: process.stdout
|
|
});
|
|
}
|
|
|
|
public handleCriticalError(err: Error): void
|
|
{
|
|
this.logger.error("The application had a critical error and failed to run");
|
|
this.logger.error(`Exception produced: ${err.name}`);
|
|
if (err.stack)
|
|
{
|
|
this.logger.error(`\nStacktrace:\n${err.stack}`);
|
|
}
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
this.readLine.question("Press Enter to close the window", (_ans) => this.readLine.close());
|
|
this.readLine.on("close", () => process.exit(1));
|
|
}
|
|
}
|