Skip to content

Commit

Permalink
Throw user-friendly error when config file fails to parse as JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
ghengeveld committed Mar 28, 2024
1 parent 36aa29a commit 9da6494
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion node-src/lib/getConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ export async function getConfiguration(
throw new Error(missingConfigurationFile(configFile));
}
}
if (err.message.match('Unexpected string')) {
if (
err.message.match('Unexpected string') ||
err.message.match('Unexpected end of JSON input')
) {
throw new Error(unparseableConfigurationFile(usedConfigFile, err));
}
if (err instanceof ZodError) {
Expand Down

0 comments on commit 9da6494

Please sign in to comment.