From ef4b922ed2382cf318e92ff6cac5796baf560cbe Mon Sep 17 00:00:00 2001 From: "Fred K. Schott" Date: Sun, 16 Feb 2020 08:52:10 -0800 Subject: [PATCH] small change to improve parse error log message (#207) * improve parse error log message * format --- src/index.ts | 10 ++++++---- src/scan-imports.ts | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/index.ts b/src/index.ts index 246d591e16..7571091513 100644 --- a/src/index.ts +++ b/src/index.ts @@ -509,10 +509,12 @@ export async function cli(args: string[]) { spinner.start(); const startTime = Date.now(); - const result = await install(installTargets, {hasBrowserlistConfig, isExplicit}, config).catch((err) => { - err.loc && console.log('\n' + chalk.red.bold(`✘ ${err.loc.file}`)); - throw err; - }); + const result = await install(installTargets, {hasBrowserlistConfig, isExplicit}, config).catch( + err => { + err.loc && console.log('\n' + chalk.red.bold(`✘ ${err.loc.file}`)); + throw err; + }, + ); if (result) { spinner.succeed( diff --git a/src/scan-imports.ts b/src/scan-imports.ts index 696bec0e61..6e097abdf2 100644 --- a/src/scan-imports.ts +++ b/src/scan-imports.ts @@ -113,7 +113,7 @@ function getInstallTargetsForFile(filePath: string, code: string): InstallTarget }, }); } catch (e) { - console.error(`[PARSE ERROR]: Skipping ${filePath}`); + console.error(`[PARSE ERROR] "${filePath}" ${e.message}`); return []; } return allImports;