UNPKG

lakutata

Version:

An IoC-based universal application framework.

164 lines (139 loc) 4.7 kB
/* Build Date: Mon Jan 05 2026 23:52:23 GMT+0800 (China Standard Time) */ import { G as e } from "../../../../vendor/Package.internal.5.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 { DevNull as a } from "../../helpers/DevNull.mjs"; import { a as n } from "../../../../vendor/Package.internal.2.mjs"; import "../../../../vendor/Package.internal.6.mjs"; import "../internal/ThrowWarning.mjs"; import "../../helpers/NoCase.mjs"; var o = { exports: {} }; o.exports; (function(e) { (function() { var s; { s = e.exports = a; } s.format = a; s.vsprintf = r; if (typeof console !== "undefined" && typeof console.log === "function") { s.printf = t; } function t() { console.log(a.apply(null, arguments)); } function r(e, s) { return a.apply(null, [ e ].concat(s)); } function a(e) { var s = 1, t = [].slice.call(arguments), r = 0, a = e.length, n = "", o, i = false, p, l, c = false, m, f = function() { return t[s++]; }, g = function() { var s = ""; while (/\d/.test(e[r])) { s += e[r++]; o = e[r]; } return s.length > 0 ? parseInt(s) : null; }; for (;r < a; ++r) { o = e[r]; if (i) { i = false; if (o == ".") { c = false; o = e[++r]; } else if (o == "0" && e[r + 1] == ".") { c = true; r += 2; o = e[r]; } else { c = true; } m = g(); switch (o) { case "b": n += parseInt(f(), 10).toString(2); break; case "c": p = f(); if (typeof p === "string" || p instanceof String) n += p; else n += String.fromCharCode(parseInt(p, 10)); break; case "d": n += parseInt(f(), 10); break; case "f": l = String(parseFloat(f()).toFixed(m || 6)); n += c ? l : l.replace(/^0/, ""); break; case "j": n += JSON.stringify(f()); break; case "o": n += "0" + parseInt(f(), 10).toString(8); break; case "s": n += f(); break; case "x": n += "0x" + parseInt(f(), 10).toString(16); break; case "X": n += "0x" + parseInt(f(), 10).toString(16).toUpperCase(); break; default: n += o; break; } } else if (o === "%") { i = true; } else { n += o; } } return n; } })(); })(o); var i = o.exports; const p = n(i); class Exception extends Error { constructor(n, ...o) { super(); this.appId = (() => e().appId)(); this.appName = (() => e().appName)(); this.statusCode = 500; if (o.length) { const e = n; const t = o.length > 1 ? o : o[0]; try { this.message = s(e, t, { ignoreMissing: true }); } catch (s) { this.message = e; a(s); } this.message = p(this.message, ...o); } else if (n) { if (typeof n === "string") { this.message = n; } else { this.message = t(n).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 };