From 0e07b25bb7a2ce58aece7195f25fa15b7bbc3254 Mon Sep 17 00:00:00 2001 From: franck403 <79372051+franck403@users.noreply.github.com> Date: Tue, 8 Oct 2024 10:06:26 -0400 Subject: [PATCH] Update parser.js --- parser/parser.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/parser/parser.js b/parser/parser.js index 39baa1f..5863df6 100644 --- a/parser/parser.js +++ b/parser/parser.js @@ -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'); @@ -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}`); } } }