Finish Powder Error Handling
This commit is contained in:
parent
1887d6b438
commit
f6e3bdcddd
1 changed files with 10 additions and 5 deletions
15
builder.js
15
builder.js
|
@ -434,20 +434,25 @@ function calculateBuild(save_skp, skp){
|
||||||
// TODO: make this more robust.
|
// TODO: make this more robust.
|
||||||
let input = getValue(powderInputs[i]);
|
let input = getValue(powderInputs[i]);
|
||||||
let powdering = [];
|
let powdering = [];
|
||||||
let errored = false;
|
let errorederrors = [];
|
||||||
while (input) {
|
while (input) {
|
||||||
let first = input.slice(0, 2);
|
let first = input.slice(0, 2);
|
||||||
let powder = powderIDs.get(first);
|
let powder = powderIDs.get(first);
|
||||||
console.log(powder);
|
console.log(powder);
|
||||||
if (powder === undefined) {
|
if (powder === undefined) {
|
||||||
errored = true;
|
errorederrors.push(first);
|
||||||
|
} else {
|
||||||
|
powdering.push(powder);
|
||||||
}
|
}
|
||||||
powdering.push(powder);
|
|
||||||
input = input.slice(2);
|
input = input.slice(2);
|
||||||
}
|
}
|
||||||
if (errored === true) {
|
if (errorederrors.length > 0) {
|
||||||
errors.push(new IncorrectInput(getValue(powderInputs[i]), "t6w6", powderInputs[i]));
|
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);
|
powderings.push(powdering);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue