Don't display stack trace for cli parse failures

Just display the error message and exit. The stack trace isn't necessary
(since it's likely user error) and is potentially confusing.
This commit is contained in:
Asher 2020-02-19 11:14:50 -06:00
parent 0e2eaa9b34
commit 80b2d9481f
No known key found for this signature in database
GPG Key ID: D63C1EF81242354A
1 changed files with 10 additions and 1 deletions

View File

@ -87,7 +87,16 @@ const main = async (args: Args): Promise<void> => {
} }
} }
const args = parse(process.argv.slice(2)) const tryParse = (): Args => {
try {
return parse(process.argv.slice(2))
} catch (error) {
console.error(error.message)
process.exit(1)
}
}
const args = tryParse()
if (args.help) { if (args.help) {
console.log("code-server", require("../../package.json").version) console.log("code-server", require("../../package.json").version)
console.log("") console.log("")