« get me outta code hell

data: validateWikiData: fix messaging for mismatch one-ref-type - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-11-04 21:01:48 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-11-04 21:01:48 -0300
commit5aad4eae6629eaa1e4dd849b03abff8888afdb4d (patch)
tree193ebf76fb10eee5e659903f0810c1435b083f5e
parent9f4c3b913fa6b12a236cedf76abe120f0321f53e (diff)
data: validateWikiData: fix messaging for mismatch one-ref-type
-rw-r--r--src/data/things/validators.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/data/things/validators.js b/src/data/things/validators.js
index ea4303f..f60c363 100644
--- a/src/data/things/validators.js
+++ b/src/data/things/validators.js
@@ -484,8 +484,10 @@ export function validateWikiData({
         throw new TypeError(`Expected array of unmixed reference types, got multiple: ${types()}`);
       }
 
-      if (referenceType && !allRefTypes.has(referenceType)) {
-        throw new TypeError(`Expected array of ${referenceType}, got array of ${allRefTypes[0]}`)
+      const onlyRefType = Array.from(allRefTypes)[0];
+
+      if (referenceType && onlyRefType !== referenceType) {
+        throw new TypeError(`Expected array of ${referenceType}, got array of ${onlyRefType}`)
       }
 
       OK = true; return true;