fix(basic.gblib): Error handling improved.
This commit is contained in:
parent
905d97925e
commit
ec47fda964
1 changed files with 6 additions and 2 deletions
|
@ -719,7 +719,11 @@ export class GBVMService extends GBService {
|
||||||
|
|
||||||
const context = vm.createContext(sandbox);
|
const context = vm.createContext(sandbox);
|
||||||
const code = min.sandBoxMap[text];
|
const code = min.sandBoxMap[text];
|
||||||
|
try {
|
||||||
vm.runInContext(code, context);
|
vm.runInContext(code, context);
|
||||||
|
} catch (error) {
|
||||||
|
throw new Error(`INVALID BASIC CODE: ${error.message} ${error.stack}`);
|
||||||
|
}
|
||||||
|
|
||||||
// Tries to find the method related to this call.
|
// Tries to find the method related to this call.
|
||||||
|
|
||||||
|
@ -738,7 +742,7 @@ export class GBVMService extends GBService {
|
||||||
ret = await sandbox[mainMethod](step);
|
ret = await sandbox[mainMethod](step);
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
GBLog.error(`BASIC ERROR: ${error.message} ${error.stack}`);
|
throw new Error(`BASIC ERROR: ${error.message} ${error.stack}`);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue