From 735369fcb9eebb5d1092b274f2628b8404850da8 Mon Sep 17 00:00:00 2001 From: Patrick Hensley Date: Tue, 9 Jan 2024 14:18:17 -0500 Subject: [PATCH] Fix command line error display --- packages/less-ts-cli/src/lessc.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/less-ts-cli/src/lessc.ts b/packages/less-ts-cli/src/lessc.ts index 87166aa..0873201 100644 --- a/packages/less-ts-cli/src/lessc.ts +++ b/packages/less-ts-cli/src/lessc.ts @@ -37,9 +37,12 @@ const run = (y: yargs.Arguments): void => { } else { const result = compiler.compile(source); console.log(result.css); - for (const err of result.errors) { - const msg = err.errors.map((e) => e.message).join(', '); - console.error(`Error ${msg}`); + + if (result.errors) { + const msgs = compiler.formatErrors(result.errors); + for (const m of msgs) { + console.error(m); + } } } } catch (e) {