🎨 Improve error messaging

This commit is contained in:
C-3PO 2018-10-23 05:25:32 +02:00
parent a7d03d3c20
commit 0f72116e30
Signed by: c3po
GPG key ID: 62993C4BB4D86F24

View file

@ -72,10 +72,10 @@ export default function parseArguments(spec: { [key: string]: IOption }): { fail
const verifyFunc = spec[argumentOption].verify; const verifyFunc = spec[argumentOption].verify;
try { try {
if (verifyFunc !== undefined && !verifyFunc(argumentValue)) { if (verifyFunc !== undefined && !verifyFunc(argumentValue)) {
failFunction(`the argument "${argumentOption}" has an invalid value "${argumentValue}"`); failFunction(`Invalid value set for option "${argumentOption}": "${argumentValue}".`);
} }
} catch (error) { } 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 //Remember the value, and if it is a required argument, mark that we have encountered it