diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2019-05-01 15:17:24 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2019-05-01 15:17:24 +0900 |
| commit | 4747ae8b61f6adba07ce30831063344a72c7d629 (patch) | |
| tree | 06b6be12a8f6c7d7ab695f33caf9ee04ff8de00e /src/client/app/common/scripts | |
| parent | Update ja-JP.yml (diff) | |
| download | misskey-4747ae8b61f6adba07ce30831063344a72c7d629.tar.gz misskey-4747ae8b61f6adba07ce30831063344a72c7d629.tar.bz2 misskey-4747ae8b61f6adba07ce30831063344a72c7d629.zip | |
Improve AiScript
Diffstat (limited to 'src/client/app/common/scripts')
| -rw-r--r-- | src/client/app/common/scripts/aiscript.ts | 12 | ||||
| -rw-r--r-- | src/client/app/common/scripts/collect-page-vars.ts | 8 |
2 files changed, 13 insertions, 7 deletions
diff --git a/src/client/app/common/scripts/aiscript.ts b/src/client/app/common/scripts/aiscript.ts index 1c4fe217c3..1e486c455d 100644 --- a/src/client/app/common/scripts/aiscript.ts +++ b/src/client/app/common/scripts/aiscript.ts @@ -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 + }); } } diff --git a/src/client/app/common/scripts/collect-page-vars.ts b/src/client/app/common/scripts/collect-page-vars.ts index 92727ce6db..683f9b73a5 100644 --- a/src/client/app/common/scripts/collect-page-vars.ts +++ b/src/client/app/common/scripts/collect-page-vars.ts @@ -6,25 +6,25 @@ export function collectPageVars(content) { pageVars.push({ name: x.name, type: 'string', - value: x.default + value: x.default || '' }); } else if (x.type === 'textareaInput') { pageVars.push({ name: x.name, type: 'string', - value: x.default + value: x.default || '' }); } else if (x.type === 'numberInput') { pageVars.push({ name: x.name, type: 'number', - value: x.default + value: x.default || 0 }); } else if (x.type === 'switch') { pageVars.push({ name: x.name, type: 'boolean', - value: x.default + value: x.default || false }); } else if (x.children) { collect(x.children); |