From 80b2d9481f4a04e1f139d08366532a66fb20dd5c Mon Sep 17 00:00:00 2001 From: Asher Date: Wed, 19 Feb 2020 11:14:50 -0600 Subject: [PATCH] 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. --- src/node/entry.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/node/entry.ts b/src/node/entry.ts index e16f8067..62696846 100644 --- a/src/node/entry.ts +++ b/src/node/entry.ts @@ -87,7 +87,16 @@ const main = async (args: Args): Promise => { } } -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) { console.log("code-server", require("../../package.json").version) console.log("")