From 9151a88ce5e348d80dc0716d45979bb1357b52b9 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:21 +0800 Subject: [PATCH] Add data errors --- scripts/utilities/errors.JS | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/scripts/utilities/errors.JS b/scripts/utilities/errors.JS index a18275e..f28ba24 100644 --- a/scripts/utilities/errors.JS +++ b/scripts/utilities/errors.JS @@ -8,6 +8,21 @@ CustomErrors.URL = class URL_Error extends Error { }; } +CustomErrors.Data = class Data_Problem extends Error { + constructor(message, data) { + super(message); + this.name = "Data-related Problem"; + this.stack = data; + } +} + +CustomErrors.Data.Missing = class DataMissing_Problem extends CustomErrors.Data { + constructor(data) { + super("The required data is missing. The stack contains the received data."); + this.name = `${this.name}: Missing Information`; + } +} + CustomErrors.DBProblem = class DB_Error extends Error { constructor(message) { super(message);