UNPKG

lakutata

Version:

An IoC-based universal application framework.

53 lines (42 loc) 1.4 kB
import { GetBasicInfo as e } from "../internal/BasicInfo.mjs"; import { Templating as s } from "../../helpers/Templating.mjs"; import { As as t } from "../../helpers/As.mjs"; import { CamelCase as r } from "../internal/CamelCase.mjs"; import "../../../../vendor/Package.6.mjs"; import "../../../../vendor/Package.5.mjs"; import "../../../../vendor/Package.7.mjs"; import "../internal/ThrowWarning.mjs"; import "../../helpers/NoCase.mjs"; class Exception extends Error { constructor(a, i) { super(); this.appId = (() => e().appId)(); this.appName = (() => e().appName)(); if (i) { const e = a; const t = i; try { this.message = s(e, t, { ignoreMissing: true }); } catch (e) { this.message = "Unknown (broken exception template or data)"; } } else if (a) { if (typeof a === "string") { this.message = a; } else { this.message = t(a).message; } } else { const e = r(this.name).toLowerCase(); this.message = `${e.charAt(0).toUpperCase()}${e.slice(1)}`; } this.errMsg = this.message; this.err = this.name; } get name() { return this.constructor.name; } } export { Exception };