an error object ALWAYS overrides the other parameters inserted

This commit is contained in:
buzz-lightsnack-2007 2024-05-11 22:44:35 +08:00
parent 0f36d2a3d2
commit 5a2a76c401

View file

@ -72,11 +72,11 @@ export default class logging {
*/ */
static async error(ERROR_CODE, ERROR_MESSAGE, ERROR_STACK, critical = true) { static async error(ERROR_CODE, ERROR_MESSAGE, ERROR_STACK, critical = true) {
// Depackage the shortcut method of sending the error message. // Depackage the shortcut method of sending the error message.
(!ERROR_MESSAGE && !ERROR_STACK && (typeof ERROR_CODE).includes(`obj`)) ? ( if ((typeof ERROR_CODE).includes(`obj`)) {
ERROR_MESSAGE = ERROR_CODE.message, ERROR_MESSAGE = ERROR_CODE.message;
ERROR_STACK = ERROR_CODE.stack, ERROR_STACK = ERROR_CODE.stack;
ERROR_CODE = ERROR_CODE.name ERROR_CODE = ERROR_CODE.name;
) : false; };
// Display the error message. // Display the error message.
(ERROR_CODE && ERROR_MESSAGE && ERROR_STACK) ? console.error(`${ERROR_CODE}: ${ERROR_MESSAGE}\n${ERROR_STACK}`) : console.error(ERROR_MESSAGE); (ERROR_CODE && ERROR_MESSAGE && ERROR_STACK) ? console.error(`${ERROR_CODE}: ${ERROR_MESSAGE}\n${ERROR_STACK}`) : console.error(ERROR_MESSAGE);