Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
someCatInTheWorld committed Aug 24, 2024
1 parent 1ced65d commit c2b209a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/compiler/jsgen.js
Original file line number Diff line number Diff line change
Expand Up @@ -1672,7 +1672,13 @@ class JSGenerator {
script += `target = thread.spoofTarget;\n`;
script += `};\n`;

script += 'try {';
script += this.source;
script += '} catch (e) {;'
// Assume it's not a special type of error.
script += 'thread.target.runtime.visualReport(thread.peekStack(), "Error: " + String(e).slice(7, String(e).length));'
script += 'retire();return;\n';
script += '};';

if (!this.isProcedure) {
script += 'retire();\n';
Expand Down
2 changes: 1 addition & 1 deletion src/engine/thread.js
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ class Thread {
} catch (error) {
log.error('cannot compile script', this.target.getName(), error);
blocks.cacheCompileError(topBlock, error);
this.target.runtime.emitCompileError(this.target, error);
this.target.runtime.visualReport(this.peekStack(), 'Error: ' + error);
return;
}
}
Expand Down

0 comments on commit c2b209a

Please sign in to comment.