IKHSAN
ENID Baca dalam Bahasa Indonesia

pixies

Public
Branch
master
Latest commit
9b0697f26 October 2026

errorHandler.js

Open raw
import fs from "node:fs";
const filePath = process.cwd() + "/data/logs/error.log";

export default (error) => {
    const date = new Date().toLocaleString();
    const lineStarter = fs.existsSync(filePath) ? "\n\n" : "# Found a bug? Report it here: https://github.com/ikhsanddy/pixies/issues\n\n";

    console.error("An error occurred: " + error.message);

    fs.writeFile(filePath, lineStarter + "## " + date + "\n" + error, {flag: 'a+'}, err => {
        if (err) console.error("Could not save error log file.", error);

        process.exit(1);
    });
};
bytes
560
lines
15
Type
js
Latest commit
26 October 2026