aboutsummaryrefslogtreecommitdiff
path: root/_mint/internal/_exceptionManager.js
diff options
context:
space:
mode:
Diffstat (limited to '_mint/internal/_exceptionManager.js')
-rw-r--r--_mint/internal/_exceptionManager.js57
1 files changed, 57 insertions, 0 deletions
diff --git a/_mint/internal/_exceptionManager.js b/_mint/internal/_exceptionManager.js
new file mode 100644
index 0000000..0f9cf7c
--- /dev/null
+++ b/_mint/internal/_exceptionManager.js
@@ -0,0 +1,57 @@
+module.exports = class MintExceptionManagerError extends Error {
+ constructor(name, message, stack) {
+ super(message);
+ if (name.startsWith("mint.lang")) {
+ let type = name.substr(10);
+ if (
+ type !== "CodeEvalException"
+ && type !== "OutOfBoundsException"
+ && type !== "VariableNotFoundException"
+ && type !== "InternalSyntaxException"
+ && type !== "IncompatibleTypesException"
+ && type !== "URIFunctionsException"
+ && type !== "CombinedFailuresException"
+ && type !== "InternalKernelException"
+ && type !== "InternalException"
+ ) {
+ this.name = "MintLangInternalException";
+ }
+ } else if (name.startsWith("js.core.")) {
+ let type = name.substr(8);
+ switch (type) {
+ case "EvalError":
+ this.name = "MintLangCodeEvalException";
+ break;
+ case "RangeError":
+ this.name = "MintLangOutOfBoundsException";
+ break;
+ case "ReferenceError":
+ this.name = "MintLangVariableNotFoundException";
+ break;
+ case "SyntaxError":
+ this.name = "MintLangInternalSyntaxException";
+ break;
+ case "TypeError":
+ this.name = "MintLangIncompatibleTypesException";
+ break;
+ case "URIError":
+ this.name = "MintLangURIFunctionsException";
+ break;
+ case "AggregateError":
+ this.name = "MintLangCombinedFailuresException";
+ break;
+ case "InternalError":
+ this.name = "MintLangInternalKernelException";
+ break;
+ default:
+ this.name = "MintLangInternalException";
+ break;
+ }
+ } else {
+ this.name = "MintLangInternalException";
+ }
+ if (typeof stack !== "undefined") {
+ this.stack = stack;
+ }
+ }
+} \ No newline at end of file