Skip to content

Commit

Permalink
add error when inkjs compilation fails
Browse files Browse the repository at this point in the history
  • Loading branch information
blurymind committed Sep 12, 2024
1 parent 015006a commit 6ea7c2a
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/js/classes/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -1260,15 +1260,21 @@ export const data = {
this.submit = text => {
this.errors = [];
this.warnings = [];
const Output = new inkjs.Compiler(text, this.compilerOptions)
try {
const Output = new inkjs.Compiler(text, this.compilerOptions)
.Compile()
.ToJson();
const newOutput = {
story: JSON.parse(Output),
warnings: this.warnings,
errors: this.errors,
};
this.onComplete(newOutput);
const newOutput = {
story: JSON.parse(Output),
warnings: this.warnings,
errors: this.errors,
};
this.onComplete(newOutput);
} catch(e) {
console.error(e);
ToastWc.show({ type: 'error', content: `Inkjs -- ${e}\nSee console for details`, time: 3000 })
}

};
this.getInkErrorGotoNode = async (inkTextFileData, inkError) => {
const inkErrorFind = inkError
Expand Down

0 comments on commit 6ea7c2a

Please sign in to comment.