From cd1d14ee8ba3acc0c7d6b1f8e35f90a5ecbdaf47 Mon Sep 17 00:00:00 2001 From: Ben Ashton Date: Mon, 5 Sep 2022 17:49:15 -0600 Subject: [PATCH] Improved CLI error messages --- cli.mjs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cli.mjs b/cli.mjs index 3bf9d90..a9798d7 100644 --- a/cli.mjs +++ b/cli.mjs @@ -31,7 +31,14 @@ const args = process.argv const fileName = args[0]; 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) { process.stdout.write(rendered);