Skip to content

Commit

Permalink
proper TS error reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
mmomtchev committed Sep 27, 2021
1 parent 33e2170 commit 07e1d8d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,10 @@ export function withCustomConfig(
);

if (errors && errors.length) {
throw errors[0];
if (errors[0] instanceof Error) throw errors[0];
else if (errors[0].messageText)
throw new Error(`TS${errors[0].code}: ${errors[0].messageText}`);
else throw new Error(JSON.stringify(errors[0]));
}

return withCompilerOptions(options, parserOpts);
Expand Down

0 comments on commit 07e1d8d

Please sign in to comment.