lakutata
Version:
An IoC-based universal application framework.
170 lines (143 loc) • 4.84 kB
JavaScript
/* Build Date: Mon Jan 05 2026 23:52:23 GMT+0800 (China Standard Time) */
;
Object.defineProperty(exports, Symbol.toStringTag, {
value: "Module"
});
const e = require("../../../../vendor/Package.internal.5.cjs");
const s = require("../../helpers/Templating.cjs");
const t = require("../../helpers/As.cjs");
const r = require("../internal/CamelCase.cjs");
const n = require("../../helpers/DevNull.cjs");
const a = require("../../../../vendor/Package.internal.2.cjs");
require("../../../../vendor/Package.internal.6.cjs");
require("../internal/ThrowWarning.cjs");
require("../../helpers/NoCase.cjs");
var i = {
exports: {}
};
i.exports;
(function(e) {
(function() {
var s;
{
s = e.exports = n;
}
s.format = n;
s.vsprintf = r;
if (typeof console !== "undefined" && typeof console.log === "function") {
s.printf = t;
}
function t() {
console.log(n.apply(null, arguments));
}
function r(e, s) {
return n.apply(null, [ e ].concat(s));
}
function n(e) {
var s = 1, t = [].slice.call(arguments), r = 0, n = e.length, a = "", i, o = false, c, l, p = false, u, f = function() {
return t[s++];
}, g = function() {
var s = "";
while (/\d/.test(e[r])) {
s += e[r++];
i = e[r];
}
return s.length > 0 ? parseInt(s) : null;
};
for (;r < n; ++r) {
i = e[r];
if (o) {
o = false;
if (i == ".") {
p = false;
i = e[++r];
} else if (i == "0" && e[r + 1] == ".") {
p = true;
r += 2;
i = e[r];
} else {
p = true;
}
u = g();
switch (i) {
case "b":
a += parseInt(f(), 10).toString(2);
break;
case "c":
c = f();
if (typeof c === "string" || c instanceof String) a += c; else a += String.fromCharCode(parseInt(c, 10));
break;
case "d":
a += parseInt(f(), 10);
break;
case "f":
l = String(parseFloat(f()).toFixed(u || 6));
a += p ? l : l.replace(/^0/, "");
break;
case "j":
a += JSON.stringify(f());
break;
case "o":
a += "0" + parseInt(f(), 10).toString(8);
break;
case "s":
a += f();
break;
case "x":
a += "0x" + parseInt(f(), 10).toString(16);
break;
case "X":
a += "0x" + parseInt(f(), 10).toString(16).toUpperCase();
break;
default:
a += i;
break;
}
} else if (i === "%") {
o = true;
} else {
a += i;
}
}
return a;
}
})();
})(i);
var o = i.exports;
const c = a.getDefaultExportFromCjs(o);
class Exception extends Error {
constructor(a, ...i) {
super();
this.appId = (() => e.GetBasicInfo().appId)();
this.appName = (() => e.GetBasicInfo().appName)();
this.statusCode = 500;
if (i.length) {
const e = a;
const t = i.length > 1 ? i : i[0];
try {
this.message = s.Templating(e, t, {
ignoreMissing: true
});
} catch (s) {
this.message = e;
n.DevNull(s);
}
this.message = c(this.message, ...i);
} else if (a) {
if (typeof a === "string") {
this.message = a;
} else {
this.message = t.As(a).message;
}
} else {
const e = r.CamelCase(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;
}
}
exports.Exception = Exception;