Improved CLI error messages

This commit is contained in:
Ben Ashton 2022-09-05 17:49:15 -06:00
parent 05b5a3902e
commit cd1d14ee8b

View File

@ -31,7 +31,14 @@ const args = process.argv
const fileName = args[0]; const fileName = args[0];
const scriptArgs = args.slice(1); const scriptArgs = args.slice(1);
const rendered = await renderFile(fileName); let rendered;
try {
rendered = await renderFile(fileName);
} catch (e) {
console.log("Error Rendering Template:")
console.log(e?.message || "Unknown Error");
process.exit(0);
}
if (compileOnly) { if (compileOnly) {
process.stdout.write(rendered); process.stdout.write(rendered);