UNPKG

sheweny

Version:

The powerful framework for create discord bots

39 lines 1.55 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ShewenyError = void 0; const constants_js_1 = require("../constants/constants.js"); const Messages = { // Loader INVALID_CLASS: (name, path) => `The class ${name} is malformed.\nPath : ${path}`, PATH_NOT_DEFINE: (classD, id) => `The class ${classD} with identifier ${id} doesn't have path.`, MISSING_PROPERTY_CLASS: (property, path) => `The property ${property} is missing on class.\nPath : ${path}`, MISSING_PATH_LOADER: () => 'Missing path for loader.', LOAD_ERROR: (path, err) => `Error during the loading of path ${path}:\n${err}`, // Evaluation EXECUTE_ERROR: (evaluate, err) => `Error during execution of ${evaluate}:\n${err} `, EVAL_ERROR: (evaluate, err) => `Error during evaluation of ${evaluate}:\n${err} `, }; class ShewenyError extends Error { constructor(client, err, ...args) { if (err instanceof Error) { if (client.mode === constants_js_1.CLIENT_MODE.dev) throw err; else client.emit('error', err); } else { const func = Messages[err]; if (!func) return; const message = func(...args); super(message); // Display error if (client.mode === 'development') throw this; else client.emit('error', this); } } } exports.ShewenyError = ShewenyError; //# sourceMappingURL=ShewenyError.js.map