diff --git a/scripts/utilities/errors.js b/scripts/utilities/errors.js new file mode 100755 index 0000000..5da24fd --- /dev/null +++ b/scripts/utilities/errors.js @@ -0,0 +1,10 @@ +class CustomErrors {} + +CustomErrors.URL = class URL_Error extends Error { + constructor(message) { + super(message); + this.name = "URL Problem"; + }; +} + +module.exports = {CustomErrors} \ No newline at end of file diff --git a/scripts/utilities/messaging.js b/scripts/utilities/messaging.js new file mode 100755 index 0000000..6ac89f7 --- /dev/null +++ b/scripts/utilities/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: ERROR}; + INSTANCE.json(MESSAGE); + console.error(ERROR); + return (MESSAGE); + } +} + +module.exports = {Messaging} \ No newline at end of file