Skip to content

Commit

Permalink
Fix handling of SyntaxError in CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
Gudahtt committed Nov 8, 2022
1 parent e3641f9 commit d16296b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,12 +352,14 @@ async function main() {
return exitWithError(
`Access to package manifest is forbidden by file access permissions: '${manifestPath}'`,
);
} else if (error.name === 'SyntaxError') {
return exitWithError(
`Package manifest cannot be parsed as JSON: '${manifestPath}'`,
);
}
}

if (error instanceof Error && error.name === 'SyntaxError') {
return exitWithError(
`Package manifest cannot be parsed as JSON: '${manifestPath}'`,
);
}
throw error;
}
}
Expand Down

0 comments on commit d16296b

Please sign in to comment.