mirror of
https://github.com/kolbytn/mindcraft.git
synced 2025-07-27 18:35: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');
|
||||
let execution_file = await import('.'+filename);
|
||||
this.clear();
|
||||
let success = await execution_file.main(this.agent.bot);
|
||||
let message = success ? 'Code await returned successfully.' : 'Code await return failed!';
|
||||
if (success)
|
||||
console.log(message)
|
||||
else
|
||||
console.error(message);
|
||||
return {success, message};
|
||||
await execution_file.main(this.agent.bot);
|
||||
let msg = 'Code executed successfully.';
|
||||
console.log(msg)
|
||||
return {success: true, message: msg};
|
||||
} catch (err) {
|
||||
console.error("Code execution triggered catch:" + err);
|
||||
this.clear();
|
||||
|
|
Loading…
Add table
Reference in a new issue