53 lines
2.5 KiB
JavaScript
53 lines
2.5 KiB
JavaScript
"use strict";
|
|
exports.id = 2317;
|
|
exports.ids = [2317];
|
|
exports.modules = {
|
|
|
|
/***/ 2317:
|
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
|
|
// @ts-check
|
|
/**
|
|
* ==============================================================================
|
|
* Imports
|
|
* ==============================================================================
|
|
*/
|
|
const fs = __webpack_require__(7147);
|
|
// const handleNodemailer = require("./handleNodemailer");
|
|
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
|
|
* ==============================================================================
|
|
* Main Function
|
|
* ==============================================================================
|
|
* @param {{
|
|
* user?: { id?: number | string, first_name?: string, last_name?: string, email?: string } & *,
|
|
* message: string,
|
|
* component?: string,
|
|
* noMail?: boolean,
|
|
* }} params - user id
|
|
*
|
|
* @returns {Promise<void>}
|
|
*/ module.exports = async function serverError({ user , message , component , noMail , }) {
|
|
const log = `🚀 SERVER ERROR ===========================\nUser Id: ${user?.id}\nUser Name: ${user?.first_name} ${user?.last_name}\nUser Email: ${user?.email}\nError Message: ${message}\nComponent: ${component}\nDate: ${Date()}\n========================================`;
|
|
if (!fs.existsSync(`./.tmp/error.log`)) {
|
|
fs.writeFileSync(`./.tmp/error.log`, "", "utf-8");
|
|
}
|
|
const initialText = fs.readFileSync(`./.tmp/error.log`, "utf-8");
|
|
fs.writeFileSync(`./.tmp/error.log`, log);
|
|
fs.appendFileSync(`./.tmp/error.log`, `\n\n\n\n\n${initialText}`);
|
|
// if (process.env.NODE_ENV?.match(/production/) && !noMail) {
|
|
// handleNodemailer({
|
|
// to: "benoti.san@gmail.com",
|
|
// subject: "SERVER Error in Datasquirel Application",
|
|
// text: "An Error occured in Datasquirel Application Server Side",
|
|
// html: log,
|
|
// });
|
|
// }
|
|
}; ////////////////////////////////////////
|
|
////////////////////////////////////////
|
|
////////////////////////////////////////
|
|
|
|
|
|
/***/ })
|
|
|
|
};
|
|
; |