From 1d2e0726da07cd7f29a380615fafd74f9d18483a Mon Sep 17 00:00:00 2001 From: buzzcode2007 <73412182+buzz-lightsnack-2007@users.noreply.github.com> Date: Thu, 20 Mar 2025 02:00:51 +0000 Subject: [PATCH] Add error messaging --- scripts/messaging.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 scripts/messaging.js diff --git a/scripts/messaging.js b/scripts/messaging.js new file mode 100644 index 0000000..d823016 --- /dev/null +++ b/scripts/messaging.js @@ -0,0 +1,16 @@ +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: {'name': ERROR.name, 'message': ERROR.message}}; + INSTANCE.json(MESSAGE); + console.error(ERROR); + return (MESSAGE); + } +} + +module.exports = {Messaging} \ No newline at end of file