From 0f72116e3049316f26045440994138132b45c6da Mon Sep 17 00:00:00 2001 From: C-3PO Date: Tue, 23 Oct 2018 05:25:32 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Improve=20error=20messaging?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/funcs/parseArguments.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/funcs/parseArguments.ts b/src/funcs/parseArguments.ts index 07cf2b1..62b066c 100644 --- a/src/funcs/parseArguments.ts +++ b/src/funcs/parseArguments.ts @@ -72,10 +72,10 @@ export default function parseArguments(spec: { [key: string]: IOption }): { fail const verifyFunc = spec[argumentOption].verify; try { if (verifyFunc !== undefined && !verifyFunc(argumentValue)) { - failFunction(`the argument "${argumentOption}" has an invalid value "${argumentValue}"`); + failFunction(`Invalid value set for option "${argumentOption}": "${argumentValue}".`); } } catch (error) { - failFunction(`Error during verification; the argument "${argumentOption}" has an invalid value "${argumentValue}"`); + failFunction(`Invalid value set for option "${argumentOption}", the validation of "${argumentValue}" failed: ${String(error)}`); } //Remember the value, and if it is a required argument, mark that we have encountered it