Skip to content

Commit

Permalink
Merge pull request styleguidist#390 from mmomtchev/ts-error-reporting
Browse files Browse the repository at this point in the history
proper TS error reporting
  • Loading branch information
pvasek authored Oct 9, 2021
2 parents dc33164 + 07e1d8d commit 3b4f60c
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 @@ -165,7 +165,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 3b4f60c

Please sign in to comment.