From 49af0811f151f115e51a35815187279e0c3ed671 Mon Sep 17 00:00:00 2001 From: buzz-lightsnack-2007 <73412182+buzz-lightsnack-2007@users.noreply.github.com> Date: Mon, 7 Apr 2025 22:24:09 +0800 Subject: [PATCH] Add messaging module --- scripts/utilities/messaging.JS | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 scripts/utilities/messaging.JS diff --git a/scripts/utilities/messaging.JS b/scripts/utilities/messaging.JS new file mode 100644 index 0000000..fdee010 --- /dev/null +++ b/scripts/utilities/messaging.JS @@ -0,0 +1,18 @@ +const CustomErrors = require(`./errors.JS`); + +class Messaging { + /* + Return an error message. + + @param {object} INSTANCE - The response instance + @param {object} ERROR - The error object + */ + static exception (INSTANCE, ERROR) { + let MESSAGE = {error: ERROR}; + INSTANCE.json(MESSAGE); + console.error(ERROR); + return (MESSAGE); + } +} + +module.exports = Messaging; \ No newline at end of file