mirror of
https://github.com/kolbytn/mindcraft.git
synced 2025-07-28 19:05:27 +02:00
fixed execution errors when generated code used returns
This commit is contained in:
parent
32810722fb
commit
cd26c646b0
1 changed files with 4 additions and 7 deletions
|
@ -74,13 +74,10 @@ export class Coder {
|
||||||
console.log('executing code...\n');
|
console.log('executing code...\n');
|
||||||
let execution_file = await import('.'+filename);
|
let execution_file = await import('.'+filename);
|
||||||
this.clear();
|
this.clear();
|
||||||
let success = await execution_file.main(this.agent.bot);
|
await execution_file.main(this.agent.bot);
|
||||||
let message = success ? 'Code await returned successfully.' : 'Code await return failed!';
|
let msg = 'Code executed successfully.';
|
||||||
if (success)
|
console.log(msg)
|
||||||
console.log(message)
|
return {success: true, message: msg};
|
||||||
else
|
|
||||||
console.error(message);
|
|
||||||
return {success, message};
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error("Code execution triggered catch:" + err);
|
console.error("Code execution triggered catch:" + err);
|
||||||
this.clear();
|
this.clear();
|
||||||
|
|
Loading…
Add table
Reference in a new issue