Skip to content

Commit

Permalink
small change to improve parse error log message (#207)
Browse files Browse the repository at this point in the history
* improve parse error log message

* format
  • Loading branch information
FredKSchott committed Feb 16, 2020
1 parent 49c8f13 commit ef4b922
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/index.ts
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion src/scan-imports.ts
Expand Up @@ -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;
Expand Down

0 comments on commit ef4b922

Please sign in to comment.