« get me outta code hell

validators: fix total number of checks reported in oneOf - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/things/validators.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-12-31 22:53:22 -0400
committer(quasar) nebula <qznebula@protonmail.com>2023-12-31 23:37:52 -0400
commitd1a84f006115148169271771f51d5d703d780b55 (patch)
tree52a11cec8f4f50be9e2c35117691af873436bbcf /src/data/things/validators.js
parent3f922377726bf3886ccb815f27c1061496e79729 (diff)
validators: fix total number of checks reported in oneOf
Diffstat (limited to 'src/data/things/validators.js')
-rw-r--r--src/data/things/validators.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/data/things/validators.js b/src/data/things/validators.js
index 75358833..ef6b7b88 100644
--- a/src/data/things/validators.js
+++ b/src/data/things/validators.js
@@ -789,8 +789,9 @@ export function oneOf(...validators) {
       errors.push(error);
     }
 
+    const total = offset + leftoverValidators.length;
     throw new AggregateError(errors,
-      `Expected one of ${validators.length} possible checks, ` +
+      `Expected one of ${total} possible checks, ` +
       `but none were true`);
   };
 }