fix: show error when too many ingredient values are provided

This commit is contained in:
Bart van Andel 2026-08-05 15:54:32 +02:00
parent b435acc6b4
commit a5ebce7f2e

View File

@ -242,6 +242,10 @@ class Operation {
* @param {Object[]} ingValues
*/
set ingValues(ingValues) {
if (ingValues.length > this._ingList.length) {
throw new OperationError(`Failed to set ingredient values: more values provided than available ingredients (${ingValues.length} vs ${this._ingList.length})`);
}
ingValues.forEach((val, i) => {
try {
this._ingList[i].value = val;