MISC: Show user-friendly error message when script is empty (#1848)

This commit is contained in:
catloversg 2024-12-18 18:17:48 +07:00 committed by GitHub
parent bb7a1fbb22
commit ab17adf97a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -81,6 +81,9 @@ function generateLoadedModule(script: Script, scripts: Map<ScriptFilePath, Scrip
return script.mod; return script.mod;
} }
if (script.code === "") {
throw new Error(`Script content is an empty string. Filename: ${script.filename}, server: ${script.server}.`);
}
let scriptCode; let scriptCode;
const fileType = getFileType(script.filename); const fileType = getFileType(script.filename);
switch (fileType) { switch (fileType) {