From f6e3bdcdddb4a9d02fa8c5c4a6e0a22e9db7569e Mon Sep 17 00:00:00 2001 From: dr-carlos Date: Mon, 18 Jan 2021 15:02:58 +1030 Subject: [PATCH] Finish Powder Error Handling --- builder.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/builder.js b/builder.js index 84a4f1e..20ba7cc 100644 --- a/builder.js +++ b/builder.js @@ -434,20 +434,25 @@ function calculateBuild(save_skp, skp){ // TODO: make this more robust. let input = getValue(powderInputs[i]); let powdering = []; - let errored = false; + let errorederrors = []; while (input) { let first = input.slice(0, 2); let powder = powderIDs.get(first); console.log(powder); if (powder === undefined) { - errored = true; + errorederrors.push(first); + } else { + powdering.push(powder); } - powdering.push(powder); input = input.slice(2); } - if (errored === true) { - errors.push(new IncorrectInput(getValue(powderInputs[i]), "t6w6", powderInputs[i])); + if (errorederrors.length > 0) { + if (errorederrors.length > 1) + errors.push(new IncorrectInput(errorederrors.join(""), "t6w6", powderInputs[i])); + else + errors.push(new IncorrectInput(errorederrors[0], "t6 or e3", powderInputs[i])); } + console.log("POWDERING" + powdering); powderings.push(powdering); }