From fa46a7f1c563063e5af7b8e71a2c05b40439c1fe Mon Sep 17 00:00:00 2001 From: buzzcode2007 <73412182+buzz-lightsnack-2007@users.noreply.github.com> Date: Wed, 19 Mar 2025 14:25:45 +0000 Subject: [PATCH] feat: Messaging errors to the user --- scripts/messaging.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 scripts/messaging.js diff --git a/scripts/messaging.js b/scripts/messaging.js new file mode 100644 index 0000000..ffb9413 --- /dev/null +++ b/scripts/messaging.js @@ -0,0 +1,15 @@ +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.name.includes(`Eval`)) ? `Invalid Date` : ERROR} + INSTANCE.json(MESSAGE); + return (MESSAGE); + } +} + +module.exports = {Messaging} \ No newline at end of file