Improve AiScript

This commit is contained in:
syuilo 2019-05-01 15:17:24 +09:00
parent b6c50d63a0
commit 4747ae8b61
No known key found for this signature in database
GPG key ID: BDC4C49D06AB9D69
8 changed files with 32 additions and 18 deletions

View file

@ -139,8 +139,12 @@ const envVarsDef = {
};
class AiScriptError extends Error {
constructor(...params) {
super(...params);
public info?: any;
constructor(message: string, info?: any) {
super(message);
this.info = info;
// Maintains proper stack trace for where our error was thrown (only available on V8)
if (Error.captureStackTrace) {
@ -178,7 +182,9 @@ class Scope {
}
throw new AiScriptError(
`No such variable '${name}' in scope '${this.name}'`);
`No such variable '${name}' in scope '${this.name}'`, {
scope: this.layerdStates
});
}
}