Skip to content

Commit 80b2d94

Browse files
committed
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.
1 parent 0e2eaa9 commit 80b2d94

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/node/entry.ts

+10-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,16 @@ const main = async (args: Args): Promise<void> => {
8787
}
8888
}
8989

90-
const args = parse(process.argv.slice(2))
90+
const tryParse = (): Args => {
91+
try {
92+
return parse(process.argv.slice(2))
93+
} catch (error) {
94+
console.error(error.message)
95+
process.exit(1)
96+
}
97+
}
98+
99+
const args = tryParse()
91100
if (args.help) {
92101
console.log("code-server", require("../../package.json").version)
93102
console.log("")

0 commit comments

Comments
 (0)