Skip to content

Commit

Permalink
Update parser.js
Browse files Browse the repository at this point in the history
  • Loading branch information
franck403 authored Oct 8, 2024
1 parent 0aebee3 commit 0e07b25
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions parser/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ class ChatterScript {

loadFromFile(filePath) {
if (!filePath.endsWith('.csc')) {
throw new Error("Invalid file extension. Please provide a '.csc' file.");
this.log.push("Invalid file extension. Please provide a '.csc' file.");
return; // Stop loading if the file extension is invalid
}

const script = fs.readFileSync(filePath, 'utf8');
Expand Down Expand Up @@ -59,8 +60,8 @@ class ChatterScript {
this.log.push(`Bot says: ${message}`);
}
} else {
// Log unsafe code detection without throwing an error
this.log.push(`Unsafe code detected: ${line}`);
throw new Error(`Unsafe code detected: ${line}`);
}
}
}
Expand Down

0 comments on commit 0e07b25

Please sign in to comment.