diff options
author | Minteck <contact@minteck.org> | 2021-12-21 15:25:09 +0100 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2021-12-21 15:25:09 +0100 |
commit | e703e51c9c09b22e3bcda9a1faf1e05897f60616 (patch) | |
tree | 4fd67a209ad6988fbf569d7dff8bc37ba45baf95 /_mint/internal | |
download | mint-e703e51c9c09b22e3bcda9a1faf1e05897f60616.tar.gz mint-e703e51c9c09b22e3bcda9a1faf1e05897f60616.tar.bz2 mint-e703e51c9c09b22e3bcda9a1faf1e05897f60616.zip |
Initial commit
Diffstat (limited to '_mint/internal')
-rw-r--r-- | _mint/internal/StdIO.js | 7 | ||||
-rw-r--r-- | _mint/internal/_exceptionManager.js | 57 |
2 files changed, 64 insertions, 0 deletions
diff --git a/_mint/internal/StdIO.js b/_mint/internal/StdIO.js new file mode 100644 index 0000000..3e35260 --- /dev/null +++ b/_mint/internal/StdIO.js @@ -0,0 +1,7 @@ +module.exports = { + stdout: { + writeln: (line) => { + console.log(line); + } + } +}
\ No newline at end of file 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 |